Wednesday, January 18, 2012
DOMPDF stream() And output() Error PDF Code
Here the case that caused error
function pdf_create($html, $filename,$pass="nofmas", $stream=TRUE, $simpan =TRUE)
{
require_once(BASEPATH."plugins/dompdf/dompdf_config.inc.php");
// require_once("dompdf/dompdf_config.inc.php");
//stream
if ($stream) {
$dompdf = new DOMPDF();
$dompdf->set_paper("slip_gaji", "portrait");
$dompdf->load_html($html);
$dompdf->render();
$dompdf->get_canvas()->get_cpdf()->setEncryption($pass, $pass, array('print'));
$dompdf->stream($filename.".pdf");
}
// simpan file
if($simpan){
$dompdf->get_canvas()->get_cpdf()->setEncryption($pass, $pass, array('print'));
write_file("./invoices_temp/$filename.pdf", $dompdf->output());
}
}
The error hapen on streamed file but correct on stored file
"Acrobat reader could not open the file 'xxxxx.pdf' because it is either not a supported file or because the file has been damaged (for example it was sent as an email attachment and wasnt correctly decoded)."
The main problem actually on the PHP file. DOMPDF and PHP 5.3.
"Function set_magic_quotes_runtime() is deprecated"
Solved by this article
http://code.google.com/p/dompdf/issues/detail?id=245
change the file
- class.pdf.php
like this attachment klik
me(Suwidi)
--
Dikirim dari suwidi.or.id dengan dukungan dev-NET(system)
