【问题标题】:Failed to load PDF document with dompdf使用 dompdf 加载 PDF 文档失败
【发布时间】:2014-06-05 02:56:43
【问题描述】:

我开始在 zend 框架 2 上编写代码并使用 DOMPDF 库生成 html 页面的 pdf 生成。这只是你好世界,结果是无法加载的 pdf。 这是我的代码

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");

有什么想法吗?非常感谢!!

【问题讨论】:

  • 我已经在我生成 PDF 的控制器中替换了您的代码(基本上是 $html),它工作正常。你能提供更多信息吗?任何错误、PHP 版本等。您可以检查 /lib/fonts/log.htm 日志文件
  • 无法加载 PDF 是什么意思?你有任何错误吗? PDF会生成吗?如果是,您的 PDF 查看器是否无法打开它?

标签: php html zend-framework2 pdf-generation dompdf


【解决方案1】:

在你的

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

在上面的代码中添加这个

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-31
    • 2013-02-08
    • 2018-07-19
    • 2015-07-09
    • 2018-08-23
    • 1970-01-01
    • 2014-01-27
    • 1970-01-01
    相关资源
    最近更新 更多