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中没有这样的文件或目录第194行的.inc.php
致命错误:require_once()[function.require]:无法打开所需的'/home/o110334/public_html/dompdf/include/firephp.cls.php'(include_path ='.:/ usr/lib/php:/ usr/local第194行/home/o110334/public_html/dompdf/dompdf_config.inc.php中的/ lib/php')
这是代码:
$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");
Run Code Online (Sandbox Code Playgroud)
Wri*_*ken 13
DOMPDF在运行本地时尝试各种各样的东西/ eval,你最好尝试:
1)通过http请求HTML的(授予的,长途旅行):
$dompdf->load_html_file('http://yourdomain.ext/'.$file);
Run Code Online (Sandbox Code Playgroud)
2)不要让DOMPDF eval使用输出缓冲本身,让DOMPDF加载生成的HTML字符串.
<?php
ob_start();
//be sure this file exists, and works outside of web context etc.)
require("admin/store/orders/45/invoice/print");
$dompdf = new DOMPDF();
$dompdf->load_html(ob_get_clean());
$dompdf->render();
?>
Run Code Online (Sandbox Code Playgroud)