简体   繁体   中英

Failed to load PDF document with dompdf

i'm starting to code on zend framework 2 and using DOMPDF library to make a pdf generation of a html page. This just hello world and the result is a pdf that fails to load. Here's my code

require_once('/home/ubuntu/learnzf2/vendor/dompdf/dompdf/dompdf_config.inc.php');
$html = "<html><body>Test</body></html>";
$dompdf = new DOMPDF();
$dompdf->set_paper('a4', 'portrait');
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("test.pdf");

Any ideas? Thanks a lot!!

in your

<?php if(!isset(whatever))dir(); ?>

add this at above of code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM