Click here to Skip to main content
15,903,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Guys,

I want to dynamically convert html file or html string to PDF in Windows Forms application.

Please help.
Posted

Please give iTextSharp[^] a try. It's a free library and can among other things be used to turn HTML into a PDF. There is even a small article here on CP to get you started: Tutorials on creating PDF files using C# 2.0[^]. Here are some more tutorials: http://www.mikesdotnetting.com/Category/20[^].
This one here is a good way to get started with iTextSharp: http://www.mikesdotnetting.com/Article/80/Create-PDFs-in-ASP.NET-getting-started-with-iTextSharp[^].

Regards,

Manfred
 
Share this answer
 
Hi, you can also try GemBox.Document component, I think it has a really simple API.
See how to [spam link removed] with 1 line of code:
C#
// Convert HTML to PDF in C#
DocumentModel.Load("Document.html").Save("Document.pdf");

VB
' Convert HTML to PDF in VB.NET
DocumentModel.Load("Document.html").Save("Document.pdf")
 
Share this answer
 
v7
Comments
irfanansari 4-Oct-13 13:45pm    
can i convert by this particular thing not completed page like
name jhone
Email: Jhone@yahoo.com
just two field not all page ?
please help me
Takalond 14-Aug-15 2:35am    
Yes that is possible, see the LoadText method, you can insert just a piece of HTML content onto your document in the specified place (the place from which you called this method).
Please check with following link,

Generate PDF documents from a HTML page using ASP.NET[^]
 
Share this answer
 

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