Simple HTML 2 PDF using PHP
An alternative for those who need to generate dynamic PDF documents. This class does not require any PDF extensions to be loaded in the PHP configuration.
The class is simple to load and use right away. You can find the class and it's documentation on it's website here: http://html2fpdf.sourceforge.net/. You can also download the class directly from me here.
The purpose of this class is to make the creation of PDF documents from HTML formatting easier, and it does the job fairly well. It seems to understand many of the most important HTML elements, as well as some CSS.
An example of simple usage:
<?php // --------------------------------- // HTML 2 (F)PDF // Homepage for this class: // http://html2fpdf.sourceforge.net/ // Homepage for the class which it is based on: // http://www.fpdf.org/ // --------------------------------- require_once('html2fpdf.php'); ob_start(); ?> <html> <body> <h1>My PDF test</h1> <div align="center">Hello, World!</div> </body> </html> <?php $html = ob_get_contents(); ob_end_clean(); $pdf = new HTML2FPDF(); $pdf->SetTopMargin(1); $pdf->AddPage(); $pdf->WriteHTML($html); $pdf->Output('test.pdf','D'); ?>