I've been doing a project lately that requires HTML2PDF generation and I was getting quite depressed at the 2 available options I'd found to do it with PHP: dompdf and html2fpdf. After trying to get them to work with the html template I set up I quickly realized that they just weren't going to work (both had problems processing images). After doing another Google search I found HTML2PS and HTML2PDF and it is practically a miracle! It seems to work pretty much the same as the Adobe PDF print driver, which is exactly what I want. The output from this program looks the same as if you would have printed it out - awesome. It's open source and doesn't have any odd requirements.
Features: "Supports nested tables, advanced CSS properties, floating DHTML elements, non-Latin character sets, XHTML and non-XHTML tags and properties, and much more. Nearly any website, even very complex ones like Yahoo.com, can be accurately converted to PostScript or PDF."
The only drawback I've found so far is that it chokes on images created from javascript apps (like mybloglog). That means I can't render out a pdf of devtrench.com with images, but it works without images and looks good. This really doesn't bother me because I'm rendering a static html page that is pretty basic, so it is kind of a non issue for me.
Comments (7)
Jan 25, 2008 at 08:31 AM
Bob Ritchie:
What's your experience with the situation reversed: PSD to HTML? Have tried out a couple, including Adobe's offering, but not found anything suitable.
Jan 25, 2008 at 02:14 PM
devtrench:
Hi Bob, I assume you mean PDF 2 HTML, and honestly I haven't gone down that road for a long time. In 2000 I converted quite a few pdfs to HTML but I can't remember what program I used, some online service I'm sure. If you do mean PSD 2 HTML then I recommend the folks at psd2html.com. They do a pretty good job :)
Oct 12, 2008 at 01:19 PM
d joseph:
Hi James, I am trying to use this html2pdf package. I have a requirement to print different pages with either landscape or portrait orientations. Did you have any experience with customizing page by page? Thanks dj
Oct 13, 2008 at 01:47 PM
devtrench:
I have experience creating batches of either landscape or portrait oriented web pages, but not combining those in a single document. The forum might be a good place to look http://forum.tufat.com/forumdisplay.php?f=58 if you haven't tried that already.
Feb 19, 2009 at 04:47 AM
Bart Nelis:
Thanks for the useful info. I have also implemented PDF generation on this website : http://www.architectuur.sintlucas.wenk.be/index.php?id=3021 (click print icon far right) But I used fpdf. (http://www.fpdf.org/) I have implemented it as a snippet in which through the MODx Api all data is collected in an array, then using fpdf, it is output in a PDF template. This allows one to make an entirely different layout for the PDF (maybe this is possible with a print css in combo with HTML2PS/HTML2PDF) It is not suited for content in which html tables etc are present. It combines nicely with markdown esque text fields, though. Just my five cents.
Mar 19, 2009 at 12:52 PM
surendra:
Thanks for giving us a awesome html2pdf converter reference
Sep 21, 2009 at 08:53 AM
elapapaaaa:
Hi, you were working under a UNIX system right? I can't get HTML2PS and HTML2PDF to work correctly using images under Windows. I read somewhere that I need to install ImageMagick but I'm not so sure about that. Do you have any recommendations regarding this matter?