|
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:
require('html2fpdf.php');
$pdf=new HTML2FPDF();
$pdf->AddPage();
$pdf->WriteHTML($strContent);
$pdf->Output("examples/$f_out");
What works
- Text using local font definitions or styles
- Tables
- JPG and PNG graphics
Limitations
- It doesn't seem to accept linking a "style" module so you have to put styles in-line.
- Tables are generated using a single font and size. Borders are limited to on and off.
- Gif images don't work (fatal error in generation). bmp and tif not supported.
See the FAQ on the HTML2PDF website for more on limitations.
Extra Features
- The <newpage> command can be inserted to force a skip to a new page.
- Pages are numbered.
- A PDF bookmark page title can be added.
Credits
- I haven't changed the system itself. I have added some notes on using it and some extra examples.
- The system was actually written in two parts. The underlying system is called FPDF and the site can be found at: http://www.fpdf.org/
- HTML2PDF interprets the html and uses FPDF to create the PDF file. It can be found at: http://html2fpdf.sourceforge.net/
Download
|