Wednesday, 15 January 2014

asp.net - TextBox controls are not Working with Export To PDF(iTextSharp) -



asp.net - TextBox controls are not Working with Export To PDF(iTextSharp) -

i have html form, contains lables , textboxes.

after filling form, exported pdf.

all label texts exported. textbox text not exported pdf.

code

protected void btnexportpdf_click(object sender, eventargs e) { response.contenttype = "application/pdf"; response.addheader("content-disposition", "attachment;filename=decform.pdf"); response.cache.setcacheability(httpcacheability.nocache); stringwriter sw = new stringwriter(); htmltextwriter hw = new htmltextwriter(sw); this.divtopdf.rendercontrol(hw); stringreader sr = new stringreader(sw.tostring()); document pdfdoc = new document(pagesize.a4, 10, 10, 2, 10); htmlworker htmlparser = new htmlworker(pdfdoc); pdfwriter.getinstance(pdfdoc, response.outputstream); pdfdoc.open(); htmlparser.parse(sr); pdfdoc.close(); response.write(pdfdoc); response.end(); }

why textbox text not exported through pdf?

i think when you're rendering divtopdf getting fresh cutting of html , not have values there populated on page. may want @ using divtopdf you'll want @ accessing innerhtml or outerhtml property , utilize that.

asp.net c#-4.0 itextsharp

No comments:

Post a Comment