html - dompdf not creating pdf correctly -
i'm using dompdf try , convert html pdf file. file created no problem when tried open file, corrupt. when opened file in notepad, see raw html. hadn't converted @ all, had put in file extension of pdf.
here code:
include_once '/files/dompdf/dompdf_config.inc.php'; $files = glob("/files/dompdf/include/*.php"); foreach($files $file) include_once($file); ob_start(); ?> <!doctype html> <html lang="en"> <head> <title> title </title> </head> <body> <div><p>hello world</p></div> </body> </html> <?php $html = ob_get_clean(); $dompdf = new dompdf(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("sample.pdf");
this grabs html written here , saves sample.pdf not proper pdf file. missing something?
i fixed stripping slashes. updated:
$html = ob_get_clean(); if ( get_magic_quotes_gpc() ) $html = stripslashes($html); $dompdf = new dompdf(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("sample.pdf");
Comments
Post a Comment