HTML to PDF for printing

Looking for a way to convert HTML to PDF for printing. Unfortunately, browsers are just behind the times when it comes to printing. Having full control over margins, top and bottom web info, and page breaks are sounding like an impossible task for print unless going with PDF.

I’m looking at PrinceXML but it’s $3800 for a license without a watermark.
The cool thing about Prince though is that the author took a HTML document and used PrinceXML to convert it to PDF, then sent it to a publisher and they printed a complete book cover to cover using it. :cool:

Is there anything else out there that is free and does the job like PrinceXML? I’m hoping to stay away from PHP since I don’t know programming all that well. I’ve also checked out FPDF but it’s pretty confusing for me as a designer.


What do you need to print? Maybe providing a separate style sheet for print that overrides the screen stylesheet will be enough for your needs without going through install HTML->PDF converters, which in all honestly are mostly rubbish. Never heard about PrinceXML though, so I can’t say anything about them, but they sound very expensive :expressionless:

Yes, just go with a nice, clean print style sheet, as Remon says. Are you sure many people are printing your pages? If it’s really that important, perhaps you should just offer a link to a PDF version on any page that’s important enough to print.

Here is the issue with printing dynamic HTML:

Pretty big margins all around the page (top, bottom, left and right) that are only controllable by the browser and Print Options screen (not controllable with CSS) and each browser is different too, web info at the top and bottom of the page in ugly Times New Roman text (added by the browser and no control over this either it seems), no way to get page numbers on the bottom of the page nicely using dynamic HTML print outs, plus if a big image shows up on the bottom of the page it gets cut in half and carries over to the next page.

This seems to be the case when using strictly tables with no divs whatsoever too… However, I have tried print CSS to resolve this but to no avail.

Therefor I have resorted to HTML to PDF generation to allow for full control over the print outs.
The reason these print outs need to be automated is because they are order forms, each controlled from the backend of the website. When a price changes or a product gets added, it’s incredibly time consuming to manually create a PDF using InDesign or Illustrator to reflect these changes.


Are you looking to print other peoples’ web pages as a pdf file?

If so, I use the free PDFCreator.

It basically installs another “printer” on your pc which outputs to a pdf file instead of an actual printer.

It works on any Windows program. So when you select File->Print in your browser or Windows program, select PDFCreator as the output printer in the Print dialog box and you will then be prompted for where to save the pdf file.

I’ve used it for a few years now and can recommend at least have a look at it to see if it’s what you need.

The following example shows how to generate a PDF document dynamically from HTML with the ABCpdf component from WebSupergoo…

Doc theDoc = new Doc();

ABCpdf uses a choice of HTML rendering engines, Internet Explorer or Firefox, so the resulting PDF should appear as you would expect to see them in these browsers. It also goes straight to PDF, without the need for a printer. You might find this is important if you wish to convert documents on the fly, unless you’re sure the printer driver is not going to block the conversion by displaying a dialog, which your website visitors won’t be able to see.

Importing an HTML page into a multi-paged PDF document and fixing the page break is also possible. Have a look for ‘Paged HTML Example’ in the documentation, and the ‘break’ properties under ‘HtmlOptions’.

Although ABCpdf is a commercial product, there is a single license for the standard edition offered free of charge as a special offer. No watermark :wink:

I found the hiqpdf html to pdf converter and it is the best I know so far