Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML document to PDF?

Tags:

asp.net

pdf

I've got an ASP.NET web page that is a dynamically generated report. For business reasons, this exact report needs to be produced as a PDF. What's the best way to do this? Setting the selected printer to Adobe PDF is not an option.

Learn to programmatically create PDFs from scratch? Is there a way to render it in some browser control, then save the ouput?

like image 363
core Avatar asked Feb 05 '09 01:02

core


People also ask

How do I save a chrome HTML document as a PDF?

Here's how to convert a Chrome HTML web page to PDF:Browse to the desired web page. Click the More Options button —three vertical dots on the far-left of the browser's top ribbon. Click on the Print option. Change Destination to Save As PDF.

Is HTML a PDF?

PDF and HTML are both file formats. For articles, the PDF and HTML files both contain the same text but there are some differences between the two. A PDF shows you what the actual article looks like (almost like a photocopy of it) and will have the actual page numbers that appeared in the article in print.

Why are my pdfs now Chrome HTML documents?

Chrome has a built-in PDF viewer and can open the PDF files. When Chrome is selected as the PDF viewer, the PDF files will change to Chrome HTML.


2 Answers

wkhtmltopdf - I compiled it in Windows and it works great. It uses WebKit (Safari, Chrome, etc.) to render an HTML page into PDF, and it is free!

like image 141
jle Avatar answered Nov 15 '22 08:11

jle


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

like image 41
jcollum Avatar answered Nov 15 '22 06:11

jcollum