Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught Mpdf\MpdfException: The HTML code size is larger than pcre.backtrack_limit 1000000

I am developing code to generate PDF from HTML code using library MPDF. For HTML Code I am reading from external HTML file. But its not working for larger HTML code size. Is there any way to fix it or do we have any other library which supports my functionality.

For larger html file giving error:

Fatal error: Uncaught Mpdf\MpdfException: The HTML code size is larger than pcre.backtrack_limit 1000000. You should use WriteHTML() with smaller string lengths.

like image 386
Satya Mahesh Avatar asked Mar 05 '18 18:03

Satya Mahesh


1 Answers

The error message tells you what to do. Pass your HTML to WriteHTML() method in smaller chunks.

Or you can try to increase your backtrack limit even more:

ini_set("pcre.backtrack_limit", "5000000");

https://mpdf.github.io/troubleshooting/known-issues.html#blank-pages-or-some-sections-missing

like image 163
Finwe Avatar answered Sep 19 '22 19:09

Finwe