我在尝试使用domPDF创建PDF文件时遇到以下错误。
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 1800 bytes) in C:'AppServ'www'tpe'reportes'dompdf'include'line_box.cls.php on line 83
有人知道为什么,我能做什么吗?为什么会出现这个问题?
这是PHP代码的一部分:
require_once("../dompdf/dompdf_config.inc.php");
if ( get_magic_quotes_gpc() ) {
$html = stripslashes($html);
$old_limit = ini_set("memory_limit", "16M");
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper('letter', 'portrait'); //landscape , portrait
$dompdf->render();
$dompdf->stream("TPE - Reporte F.E.A. $asignaturashort.pdf");
exit(0);
}
我已经试过将"记忆限制"提高到24M,但似乎没有效果。
DOMPDF将占用大量内存,这取决于您试图转换的HTML。可能超过2400万。首先试着用你能给予的最高记忆。还要确保你有最新的版本。
如果这不起作用,你可能不得不为你的问题找到另一个解决方案。