Click here to Skip to main content
14,975,553 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
help me Convert HTML string to PDF using ItextSharp
Posted
Comments
Sergey Alexandrovich Kryukov 27-May-11 23:50pm
   
What did you try? What is not working?
--SA
[no name] 27-May-11 23:58pm
   
post what you have done so far, let us take a look and correct the mistake

Hey! Why not try Google it will give you plenty of article to learn how to convert HTML string to PDF using ITextSharp whatever you can start from here[^]
and if you have tried something and have problem so please share your effort with us we will try to solve it.
   
Comments
hoa20101988 28-May-11 0:24am
   
i search google but don't find demo.i'm vietnamese so will correct the mistake.i'm sorry
   
Comments
hoa20101988 28-May-11 3:21am
   
Thanks but you have to different demo i need.
private void ConvertHtmlToPdf()
{
StringBuilder sbHtmlText = new StringBuilder();
sbHtmlText.Append("Employee Info");
sbHtmlText.Append("Hi This is Employee Info");

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(sbHtmlText.ToString()));
document.Close();
}
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900