Ad

Dompdf Package For Laravel 4 Return 500 When Many ( >9 ) Pages Are Generated

- 1 answer

I'm using this Dompdf package for Laravel 4 by Jonathan Thuau and I'm getting server error whenever I try to generate more than 9 gapes otherwise it works.

Below is the screenshot of the error enter image description here

Below is also my config file , let me know if I have to change anything in that

return array(
'DOMPDF_TEMP_DIR' => sys_get_temp_dir(),
'DOMPDF_UNICODE_ENABLED' => true,
'DOMPDF_PDF_BACKEND' => 'CPDF',
'DOMPDF_DEFAULT_MEDIA_TYPE' => 'screen',
'DOMPDF_DEFAULT_PAPER_SIZE' => 'letter',
'DOMPDF_DEFAULT_FONT' => 'serif',
'DOMPDF_DPI' => 96,
'DOMPDF_ENABLE_PHP' => false,
'DOMPDF_ENABLE_REMOTE' => false,
'DOMPDF_ENABLE_CSS_FLOAT' => false,
'DOMPDF_ENABLE_JAVASCRIPT' => true,
'DEBUGPNG' => false,
'DEBUGKEEPTEMP' => false,
'DEBUGCSS' => false,
'DEBUG_LAYOUT' => false,
'DEBUG_LAYOUT_LINES' => true,
'DEBUG_LAYOUT_BLOCKS' => true,
'DEBUG_LAYOUT_INLINE' => true,
'DOMPDF_FONT_HEIGHT_RATIO' => 1.1,
'DEBUG_LAYOUT_PADDINGBOX' => true,
'DOMPDF_ENABLE_HTML5PARSER' => false,
'DOMPDF_ENABLE_FONTSUBSETTING' => false,
'DOMPDF_ADMIN_USERNAME' => 'user',
'DOMPDF_ADMIN_PASSWORD' => 'password',
);
Ad

Answer

The error was due to resource exhaustion and I have to add to following lines on top of the page and it worked

set_time_limit(0);
ini_set("memory_limit",-1);
ini_set('max_execution_time', 0);
Ad
source: stackoverflow.com
Ad