Limit of pages in PHP mPDF


Good morning. I am using the mPDF library for PHP, which I am having problems when displaying more than 33 pages, if the information grows to the point of reaching 34 or more pages, it does not show information or errors. I already tried changing the PHP timeout, activating the debug mode of the library and it does not work. Is there a limit of sheets per file in the library? Any suggestions? Greetings.

asked by user3680708 13.02.2018 в 01:09

1 answer


According to the documentation (in English):

Blank pages or some missing sections

If you transfer a large amount of code, using WriteHTML() either as CSS styles or as HTML code, you can get a blank page as a result.

The PHP function preg_replace() has a maximum string length that will scan, by default, around 100,000 characters. On this, if it is exceeded, PHP will silently return a null value. Therefore, long strings of code will be replaced by nothing!

You can increase the value of pcre.backtrack_limit in Run time if your system allows it. pcre.backtrack_limit is configurable from PHP > = 5.2.0

As a solution: Divide your HTML into fragments and pass them one at a time to WriteHTML() .

The program dies without displaying an error message when generating a large PDF file

There is a timeout due to Apache settings TimeOut will cause the script to finish without displaying an error message.

As a solution: Increase the PHP time limit.

answered by 13.02.2018 в 01:26