HTTP/1.1 // 38.107.191.89 // // 57304 // // CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

Clicktale

HTML2PS and HTML2PDF – Best HTML to PDF Converter

Jan
9
2008

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.

HTML2PS and HTML2PDF Pros and Cons

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.


7 Comments »

Allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
MyAvatars 0.2

Comment by Bob Ritchie
on 25 Jan 2008 at 8:31 am # Subscribed to comments via email

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.

 
MyAvatars 0.2

Comment by James Ehly
on 25 Jan 2008 at 2:14 pm #

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 :)

 
MyAvatars 0.2

Comment by d joseph
on 12 Oct 2008 at 1:19 pm #

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

MyAvatars 0.2

Comment by James Ehly
on 13 Oct 2008 at 1:47 pm #

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.

 
 
MyAvatars 0.2

Comment by Bart Nelis
on 19 Feb 2009 at 4:47 am #

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.

 
MyAvatars 0.2

Comment by surendra
on 19 Mar 2009 at 12:52 pm #

Thanks for giving us a awesome html2pdf converter reference

 
MyAvatars 0.2

Comment by elapapaaaa
on 21 Sep 2009 at 8:53 am #

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?