c# - How to convert stringbuilder text and get pdf format file output in asp.net -
i'm using visual studio 2008 , need convert stringbulider text , pdf format output file on button click event..
following sample stringbuilder text.
stringbuilder reqreport = new stringbuilder(); reqreport.append("<li>five copies of latest passport size.</li>"); reqreport.append("<li>your certificates, testimonials etc. (in original 1 photocopy)</li>"); reqreport.append("<li>residence & identity proof required in bank account opening process per rbi guidelines.</li>");
i tried using itextsharp..
string html = reqreport.tostring(); document pdfdoc = new document(pagesize.a4, 10f, 10f, 10f, 0f); pdfwriter writer = pdfwriter.getinstance(pdfdoc, response.outputstream); pdfdoc.open(); system.xml.xmltextreader _xmlr = new system.xml.xmltextreader(new stringreader(html)); htmlparser.parse(pdfdoc, _xmlr); response.contenttype = "application/pdf"; response.addheader("content-disposition", "attachment;filename=table.pdf"); response.cache.setcacheability(httpcacheability.nocache); response.write(pdfdoc); response.end();
this creates pdf file.. when try open file, shows the file either corrupted or damaged , not opened..
is there other format function..?
thanks in advance...
Comments
Post a Comment