Blog

Convert HTML to PDF in Seconds Using PHP DOMPDF

Sample Code for DOMPDF

Instruction to Follow
1. Write Only Inline CSS
2. Can Use DIV tags But TABLE is recommended
3. Provide Full Url for the images. In Certain Hosting the Image tag method don’t Work. In that case Use it as a background image using Inline CSS

include(“dompdf/dompdf_config.inc.php”);
$content = stripslashes(‘Hello World’);
ini_set(“memory_limit”, “64M”);
$dompdf = new DOMPDF();
$dompdf->load_html($content);
$dompdf->set_paper(“letter”,”portrait”);
$dompdf->render();
$dompdf->stream(“myFirstPDF.pdf”);
?>
Download the DOMPDF Class Files from http://code.google.com/p/dompdf/downloads/list

This Post Has 0 Comments

Leave A Reply