Archive

Posts Tagged ‘www ca’

HTML to PDF (using DOMPDF) – PHP

August 28th, 2008 Jigish Thakar 13 comments

After using the FPDF library, I came to know that making PDF using the same is so time consuming. And some time it is not possible to develop the report as per the users requirement because of its limitation. Then I found the DOMPDF library in which we just need to pass the HTML code as string to the its class and the PDF will be generated. Even thought it has some limitations but for some level this is the best way of generating PDF through PHP.

The link and the example for this is as given below:

http://www.digitaljunkies.ca/dompdf/

 

<?php

require_once("dompdf_config.inc.php");

$html =  '<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");

?>

so guys take the advantage of such a nice efforts…

..