Can you please point me to open source or a reasonably priced comercial product capable of generating PDF from HTML?
-
http://www.google.com.au/search?hl=en&q=generate+pdf+from+html&meta= – Mitch Wheat Mar 01 '09 at 00:37
-
1possible duplicate of http://stackoverflow.com/questions/564650/convert-html-to-pdf-in-net – Jørn Schou-Rode Apr 13 '10 at 18:57
-
To list out another solution that you can try, [GemBox.Documnet](http://www.gemboxsoftware.com/document/overview). Also [here](http://www.gemboxsoftware.com/document/articles/c-sharp-vb-net-convert-html-to-pdf) is a sample code that shows how to convert HTML to PDF with it. – Mario Z Feb 24 '16 at 06:06
12 Answers
We currently use ABCpdf in one of our more complex applications. It has served us well and is not very expensive at all. I like that fact that I can send it raw HTML text and it will render it to a PDF in memory or as a file so we use to generate PDFs on the fly and serve them up via the web without actually ever saving it disk ever.
We have been using it for about 3 years and early on I had to use their support for a very odd issue that was very specific and the support was very fast and help solved the issue quickly.
You can find more information on their website at: http://www.websupergoo.com/abcpdf-1.htm

- 47,246
- 16
- 124
- 162
By nature of the task (HTML to PDF conversion) pretty looking PDF generation tool should able to render HTML like web-browser. Fortunately it is already exists: WkHtmlToPdf open source project but it doesn't provide any integration with .NET from the box.
Don't spend your time on reinventing the wheel: I've already packed WkHtmlToPdf into one DLL (no external dependencies at all), just add it to your project and generate PDF with one line of code:
var pdfBytes = (new NReco.HtmlToPdfConverter()).GeneratePdf(htmlContent);
Additionally, it's possible to specify various options (like margins, zoom-factor etc) through HtmlToPdfConverter's properties.
DLL can be downloaded here (it's FREE): PdfGenerator for .NET

- 8,447
- 3
- 37
- 34
-
Is there a way to merge a landscape pdf with a portrait pdf with this dll? I need a portrait cover page merged with a landscape pdf. – LukeP Apr 07 '14 at 18:56
-
1No, WkHtmlToPdf generates either landscape or portrait orientation for whole PDF by HTML template. But you can use iText.NET (legacy version 4.1.6 which allows usage in commercial projects for free) for merging existing PDF files into one resulting PDF. – Vitaliy Fedorchenko Apr 09 '14 at 06:12

- 15,750
- 7
- 49
- 56
-
-
2DocRaptor.com is a great alternative because it uses Prince XML as the engine, but it's much cheaper (free for small plans) – Julie Jan 19 '11 at 01:41
We've used ABCPdf in the past and it's able to take a web request and generate a PDF from it

- 24,927
- 18
- 98
- 150
We've had a lot of success with an open source product called 'itextsharp' - it's not so hot at the HTML-to-PDF but is good for carefully piecing together a specific PDF document (such as a receipt). It's also free, which is always a bonus. See:
http://sourceforge.net/projects/itextsharp/
Another quick and lightweight solution is XMLPdf, written by a software company called Ibex from New Zealand no less. This tool has a model where you create an XML template file, with HTML-ish tags in the schema. You can also define tags in the XML which you associate with objects in your .NET code behind. Kind of clunky, but useful in particular circumstances. Not free, but cheap. Can find it by searching for XMLpdf on Google.

- 14,394
- 16
- 76
- 91
Here is HTML to PDF .NET component at the reasonable price. But it has own html/css reading and pdf rendering engines.

- 228
- 1
- 2
- 10
Using the (commercial) Aspose.Pdf since years successfully. Works both for .NET and Java.

- 39,551
- 56
- 175
- 291
Abcpdf .Net version 8 works but it creates lot of issue in production servers where security and user rights are restrictive.
It is difficult to directly to do URL->pdf conversion. We ended up URL-Save HTML in local folder ->read HTML and convert to PDF-> delete HTML file from folder - tricky approach but it works. The only flaw is that you need to give read/write permission on a folder on server. Its still better than decreasing security settings.

- 2,908
- 1
- 23
- 24
One alternative solution would be to use the web browser control and print the html to an installed PDF printer.
There are several free PDF printers available and they can be set up to print directly to a file without displaying a user interface.
I used a solution like this once and it worked fine even for large documents and large numbers of documents.

- 35,612
- 10
- 61
- 76