【发布时间】:2015-01-30 20:18:54
【问题描述】:
我正在尝试在 wrpdress 页面上实现 DOMPDF 库。该页面有一个自定义模板,所以我把这段代码放在那里:
<?php /**
/*
* Template name: Prova
*/
get_header();
require_once (get_template_directory() . '/dompdf/dompdf_config.inc.php');
$dompdf = new DOMPDF();
$html =
'<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");
get_footer();
?>
页面加载正确,我可以看到模板的页眉和页脚,但 dompdf 似乎不起作用,因为没有生成 pdf。路径是正确的。不显示错误消息。我错过了什么吗?
谢谢
【问题讨论】: