skip to content

 Web design 

Database-driven systems

Easy-to-maintain web sites


 



PDF Output - HTML2PDF

This is an open source package that can convert HTML to a PDF. You can call it from a PHP program with the HTML and it will create the PDF for you. There is a new / better version that I have now started to use. It can be found at:
New HTML2PDF.

For my HTML2PDF notes click here.

The new version seems to work well and I recommend it. You will find other open source classes that produce PDFs but they usually require special commands to provide detailed format information for the creation of the PDF. If you have well-formatted html that is currently producing your report, then it shouldn't be a big job to convert it to use HTML2PDF.

If you are working in PHP and generating html output to the browser / screen then you can use this facility by writing all of the html to a variable and then pass the variable to HTML2PDF. Even if you don't specifically need a PDF it provides extra useful features like pagination that may make it worthwhile to use it to produce output.

Between the examples provided with the package and some additional testing that I have done, this seems to be a great improvement over the previous version. This version is also supported and developed where the old one had very minimal documentation and no apparent support.

One key thing to note is that this facility is not as forgiving as a browser in terms of the html that it will accept. You need proper closing tags or it will not work.


Previous Version
This info is still here for reference but if you are starting from scratch, you will want to use the newer version and the link at the start of this page.

The original system information can be found here but the site and the documentation isn't very complete. I added some additional examples and some notes to make it a bit easier. More info can be found on my Downloads page.

 
   

Powered by Website Baker,
Design by Innovations Design based on a template by gavjof