Thursday, April 1, 2010

Simple Html 2 pdf using php

The following is a nice alternative for those who need to generate dynamic PDF documents on-the-go. 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/

It is based upon (F)PDF which you can find here: http://www.fpdf.org/

You can download a usable version directly from 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:



Create a new page with text like hello world, test and save it as test.php

SetTopMargin(1);
$pdf->AddPage();
$pdf->WriteHTML($html);
$pdf->Output('test.pdf','D');
?>

to view details tutorials at - http://thronic.com/2008/development/simple-html-2-pdf-using-php/

1 comment:

  1. but google chrome use koreo kora jay...Ctrl+P ....then "Save As Pdf"

    ReplyDelete

Followers