您好,我在我的网站上安装了 mybb。我还安装了 dompdf 并在它自己的目录中工作,即我已经安装在 "DOM"
目录中。现在我可以使用这个简单的代码轻松生成 pdf,保存在 "DOM"
目录中。
<?php
require_once "dompdf_config.inc.php";
//$file = "www/test/css_at_font_face.html";
$file="msf.html";
$dompdf = new DOMPDF();
$dompdf->load_html_file($file);
$dompdf->render();
$dompdf->stream("sample.pdf");
?>
如果我尝试访问 director DOM
之外的其他文件,即
load_html_file($文件); $dompdf->渲染(); $dompdf->stream("sample.pdf");
?>
我收到错误 Remote file requested, but DOMPDF_ENABLE_REMOTE is false
最佳答案
为了启用远程访问不要编辑“dompdf_config.inc.php”
改用:
$dompdf = new DOMPDF();
$dompdf->set_option('enable_remote', TRUE);
$dompdf->set_option('enable_css_float', TRUE);
$dompdf->set_option('enable_html5_parser', FALSE);
关于php - 在 DOMpdf 目录外使用 DOM PDF 创建 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14612531/