Dompdf: "Maximum execution time of 30 seconds exceeded"

Mike picture Mike · Jan 2, 2014 · Viewed 15.1k times · Source

Consistently (meaning every time) I try to load a relatively large amount of HTML related to a client form into dompdf. I get either the subject error message or, occasionally, some other error. If I comment out the code for any one of what would be 9 pages in a PDF document, it works.

I've had the same problem in the past with variable length reports (this is a form that is always 9 pages) once a certain indeterminate critical mass of data is reached. Other posts I've seen related to this issue always include follow up comments insisting that the original poster provide the HTML. I tried to do that but it far exceeds the limit allowed.

To reduce the amount of HTML would result in HTML that dompdf would have no problem rendering, so I'm not sure how to proceed to get a resolution for this. I could provide a link to the page but it would require a userid & password for access and the resulting page would include information that is not for public consumption.

If there is no help to be had here can anyone suggest another forum where I could get help?

Here are a few specifics about the HTML that I can list that might be of help in diagnosing the problem:

  • It's built almost entirely using HTML tables.
  • None of the tables span multiple pages.
  • There are no textarea controls.

Answer

Ben Hitchcock picture Ben Hitchcock · Jan 6, 2014

I had similar issues with domPdf as well, and couldn't resolve them. I guess you could always stick an ini_set for max_execution_time in your controller if you're stuck.

Eventually I moved to MPDF and this works really well for me. It seems to be the most portable, and well maintained PHP HTML to PDF library that I've found.

I'm not sure I should post this as an answer or a comment, let me know if this should be a comment instead.