HTML document to PDF?

I have an ASP.NET webpage that is a dynamically generated report. For business reasons, this accurate report must be prepared in PDF format. What is the best way to do this? Installing the selected printer in Adobe PDF is not an option.

Learn to programmatically create PDF files from scratch? Is there a way to do this in some browsers and then save the output?

+6
source share
10 answers

wkhtmltopdf - I compiled it on Windows and it works great. It uses WebKit (Safari, Chrome, etc.) to render HTML pages to PDF, and it's free!

+8
source share

If the report is a grid (perhaps it is), this blog post using iTextSharp may help. iTextSharp is the good and most comprehensive PDF API for C # I've seen.

+4
source share

I do not know if ABCpdf.NET is free, but I heard well about it. I think it can directly display HTML files in PDF.

http://www.websupergoo.com/abcpdf-5.htm

I used PDFsharp (assuming you are using C # in conjunction with ASP) and it works well. As far as I know, it does not display HTML.

http://pdfsharp.com/PDFsharp/

+3
source share

Last year I did a project with PDF files, and I just studied the PDF format, which I am very happy about.

The PDF specification is freely available, and the PDF is reasonably accessible and easy to understand as a programmer. PDF is a text document that can be compressed. Each page is a Cartesian plane on which you draw geometric shapes one by one. It is low level and adapted for creating software. Obviously there are advanced things like glyphs and things, but like any well-designed technology, you can stick to layers of abstraction if you want.

Whether direct PDF depends on the complexity of your documents. For basic materials with simple graphics, text and images (for example, an invoice is a good candidate), then I will just write the PDF directly. You will get a good experience and you will be in full control.

For more complex things like tables and pie charts (for which the PDF is too low level for direct recording), I would look into a library or some toolkit.

+3
source share

These links may help:

http://www.411asp.net/home/assembly/document/pdf

http://alt-soft.com/Support_kb_generating_pdf_from_asp_net.aspx

Some languages ​​can do this out of the box, and you can get some external services that can also create PDF files, but it looks like the asp.net solution is really what you need.

NTN

0
source share

If you are specifically focused on creating PDF files, I can recommend Dynamic PDF products from CeTe. They are a little expensive, but they have many options, they are easy to use and well documented.

0
source share

Have you looked at SQL Server Reporting Services? If you are using MSSQL 2005/2008, you probably already have Reporting Services, and you just need to configure it. You can place your reports there, and with just a few lines of code get the report as a PDF file.

//create the web request for the report based on a URL that will define export //format, parameter values, etc. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(reportUrl); //send creditials if necessary request.Credentials = new NetworkCredential(userName, password); //response will contain the PDF file as a stream HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 

Here is a link that may also help.

0
source share

Use the PDF Duo.NET component. It converts HTML to PDF, so after generating your HTML report, you can create a PDF file in your ASP.NET project.

0
source share

You can also find products that do this from Adobe , Foxit and Windward Reports (disclaimer - I am Windward CTO).

0
source share

You didn’t mention you if you are looking for an open source solution or $$ one?

But here is an open source converter: http://sourceforge.net/projects/itextsharp/ which is pretty decent.

-one
source share

All Articles