TCPDF Timeouts

Problem

When generating a PDF invoice or quote (for example, during the daily automation cron tasks), you encounter a maximum execution time exceeded fatal error:

Maximum execution time of 300 seconds exceeded in /path/to/whmcs/vendor/tecnickcom/tcpdf/tcpdf.php

Cause

This error may be due to a high-resolution logo image in the PDF file, increasing the necessary amount of time to generate the PDF file above the specified PHP max_execution_time configuration.

Solution

To resolve this issue, resize the logo image to smaller dimensions and reduce the file size.

  • The logo image normally exists at /assets/img/logo.png or /assets/img/logo.jpg.
  • A logo with dimensions of 300 x 100 pixels is usually sufficient.

After you resize the image, upload the smaller logo image, overwriting the original larger logo image file.

If you have a customized PDF template, the logo image may have a different filename or location. Check the invoicepdf.tpl and quotepdf.tpl files for custom code and adjust them as necessary.

Last modified: May 29, 2024