dompdf:加载要渲染的 html 文件,不起作用
dompdf 无法从我的网站页面生成 pdf。不过,我已经保存了该页面并将其作为简单的静态 html 文件上传,并且它有效!
所以,我不知道问题是否出在 url 上,还是其他什么问题。这是我得到的错误:
警告:require_once(/home/o110334/public_html/dompdf/include/firephp.cls.php)[function.require-once]:无法打开流:/home/o110334/public_html/中没有这样的文件或目录dompdf/dompdf_config.inc.php 第 194 行
致命错误:require_once() [function.require]:无法打开所需的“/home/o110334/public_html/dompdf/include/firephp.cls.php”(include_path='.:/usr/lib/php:/ usr/local/lib/php') 在 /home/o110334/public_html/dompdf/dompdf_config.inc.php 第 194 行
这是代码:
$file = "admin/store/orders/45/invoice/print"; // doesn't work
//$file = "invoice_sample2.html"; //it works (same web page, but stored in a html file)
$dompdf = new DOMPDF();
$dompdf->load_html_file($file);
$dompdf->render();
$dompdf->stream("sample.pdf");
dompdf is not able to generate a pdf from a page of my website. However, I've saved the page and uploaded it as simple static html file, and it worked!
So, I don't know if the issue is with the url, or something else.. this is the error I get:
Warning: require_once(/home/o110334/public_html/dompdf/include/firephp.cls.php) [function.require-once]: failed to open stream: No such file or directory in /home/o110334/public_html/dompdf/dompdf_config.inc.php on line 194
Fatal error: require_once() [function.require]: Failed opening required '/home/o110334/public_html/dompdf/include/firephp.cls.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/o110334/public_html/dompdf/dompdf_config.inc.php on line 194
This is the code:
$file = "admin/store/orders/45/invoice/print"; // doesn't work
//$file = "invoice_sample2.html"; //it works (same web page, but stored in a html file)
$dompdf = new DOMPDF();
$dompdf->load_html_file($file);
$dompdf->render();
$dompdf->stream("sample.pdf");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DOMPDF 在本地运行时会尝试各种东西/评估,你最好尝试:
1)通过 http 请求 HTML(当然,长途旅行):
2)不要让 DOMPDF
eval 但使用输出缓冲本身,并让 DOMPDF 加载生成的 HTML 字符串。
DOMPDF is trying all kinds of stuff/eval's when running local, you're better of trying:
1) the (granted, long way trip) of requesting the HTML by http:
2) Don't let DOMPDF
eval
but use output buffering itself, and let DOMPDF load the resulting string of HTML.