Php – DOMPDF – Allowed memory size of bytes exhausted

dompdfPHP

I am getting the following error when try to create a PDF file with domPDF.

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

Do somebody know why and what can I do and why this problem is coming up?

This is part of the PHP code:

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

I already tried increasing "memory limit" up to 24M but is seems not having effect.

Best Answer

DOMPDF will take a lot of memory depending on the HTML you are trying to convert. Propably more than 24M. First try with the highest you can give for memory. Also make sure you have the latest version.

If this doesn't work, you might have to find another solution for your problem.