html2pdf 3.3 review

by on

html2pdf is a PHP class that makes it easy to convert HTML documents to PDF files on the fly

License: GPL (GNU General Public License)
File size: 987K
Developer: Jason Rust
0 stars award from

html2pdf is a PHP class that makes it easy to convert HTML documents to PDF files on the fly.

html2pdf grew out of the need to convert HTML files (which are easy to create) to PDF files (which are not so easy to create) fast and easily.

PHP: Version 4.0.4 or greater.
html2ps: Does the initial conversion of html to a postscript file, and thus is the most crucial part of the conversion. If running windows you will need to install activeperl as well.
ps2pdf: This comes with the Ghostscript package. This package is normally
installed as an RPM on RedHat systems, so if you're using that OS you shouldn't have to worry. There is a windows install for this as well.
curl: Or some program that grabs documents off the web (lynx, w3m, etc.). HOWEVER, for whatever reason only curl has worked in my tests when the script page is running as a web script and not just a script from the command line.
PEAR: The default installation of PEAR is needed for the error handling and OS checking. PEAR comes with the default installation of PHP 4 so you should normally not have to worry.
Valid HTML: Good HTML (XHTML is best) definitely helps.
PDFEncryptor needs java ( and the iText jar file.

Here are some key features of "html2pdf":
The ability to encrypt and set permissions on the PDF file on the fly.
The ability to set the header and footer text, including the color.
The ability to set the page size and margins.
The ability to convert images in the webpage to images embedded in the PDF. The script tries to convert relative image paths in to absolute ones as well.
The ability to use the CSS in the HTML file in the creation of the PDF. This includes remote CSS files as well.
The ability to convert remote files.
The ability to convert links into embedded clickable links in the PDF file
The ability to scale the HTML page.
Easy setting of any of these options through the methods of the class.
Tries to fix quirks in html pages which break html2ps.
PEAR error handling.
Works on both Unix/Linux and Windows.

Any limitations that html2ps has this script has. Thus, CSS attributes within a tag, such as class or style are not noticed. Best results are obtained by coding the colors and styles directly into the HTML using attributes such as bgcolor and color.
Does not render form elements very well.

What's New in This Release:
Fixed bug where empty headers and footers were not being set correctly.
Fixed a bug where some versions of html2ps require an html extension on the tmp file.
Added support for retrieving remote pages over https.
The include path for ps2pdf can now be set (to specify where to search for font files).
Changing relative image paths to absolute urls is now an option (on by default). If turned off the image urls will be left relative allowing for the images to be pulled from the local machine.

html2pdf 3.3 search tags