skip to content

 Web design 

Database-driven systems

Easy-to-maintain web sites


HTML2PDF - New Version Notes

These notes are based on HTML2PDF ver 3.21 dated 2010-05-07. They should still be valid for newer versions.


HTML2PDF allows you to take existing html output (with some limitations) and create a PDF file. If you are working in PHP, then the html that is used to create a screen display can be used to create a PDF file.

Using it is as simple as:



     This is a simple example of using HTML2PDF

// -------- This is our input ----------------
//  This example is setup to show pagination with headers and footers

$strContent = '
Here is some test text
The end of page 1
Here is the page header
Here is page 2 can I do another page this way?
Yes I can
This is the page footer
Now here is page 3 '; // --------------------------------------------------------------- require_once(dirname(__FILE__).'/../html2pdf.class.php'); try { $pdf = new HTML2PDF(); $pdf->setDefaultFont('Arial'); $pdf->WriteHTML($strContent); $pdf->Output("$f_out"); } catch(HTML2PDF_exception $e) { echo "
ERROR: ".$e; }

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