top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to save specific html portion into pdf using asp.net?

+3 votes
889 views

I want to save specific html portion into pdf using asp.net into MS SQL SERVER 2008. I know it will done will itextsharp.dll library file from .NET conversion but tell me through example.

posted Dec 4, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

See if this helps

Document document = new Document();
PdfWriter.GetInstance(document, new FileStream(Request.PhysicalApplicationPath + "\\MySamplePDF.pdf", FileMode.Create));
document.Open();
iTextSharp.text.html.simpleparser.HTMLWorker hw = 
             new iTextSharp.text.html.simpleparser.HTMLWorker(document);
hw.Parse(new StringReader(htmlText));
document.Close();

Also see the following blogs may be helpful
http://hspinfo.wordpress.com/2008/01/12/how-to-convert-html-content-to-pdf-file/

answer Dec 5, 2013 by Luv Kumar
...