I've found TCPDF to be running quite slowly... it takes around 15 seconds or more to generate a PDF. Are there any suggestions to speed up TCPDF or increase the PHP maximum execution time? When I try to process multiple PDFs I am receiving the error "Maximum execution time of 30 seconds exceeded on line 5404 in ~/httpdocs/vendors/tcpdf/tcpdf.php"
In reading TCPDF's website, it makes the following recommendations to speed things up. Any tips on how to implement any of these that would be useful to Blesta?
Install and configure a PHP opcode cacher like XCache;
Edit the php.ini file and increase the maximum amount of memory a script may consume (memory_limit);
Edit the php.ini file and increase the maximum execution time of each script (max_execution_time);
Edit the config/tcpdf_config.php file: manually set the $_SERVER['DOCUMENT_ROOT'], K_PATH_MAIN and K_PATH_URL constants, and remove the automatic calculation part;
If you are not using the Thai language, edit the config/tcpdf_config.php file and set the K_THAI_TOPCHARS constant to false;
If you do not need extended chars, edit the config/tcpdf_config.php file and set the default fonts to core fonts;
If you do not need UTF-8 Unicode, set the $unicode parameter on TCPDF constructor to false and the $encoding parameter to 'ISO-8859-1' or other character map.
By default TCPDF enables font subsetting to reduce the size of embedded Unicode TTF fonts, this process, that is very slow and requires a lot of memory, can be turned off using setFontSubsetting(false) method;
Use core fonts instead of embedded fonts whenever possible;
Avoid using the HTML syntax (writeHTML and writeHTMLCell methods) if not strictly required;
Split large HTML blocks in smaller pieces;
Avoid using transactions if not strictly required;
Question
PhatPixel
I've found TCPDF to be running quite slowly... it takes around 15 seconds or more to generate a PDF. Are there any suggestions to speed up TCPDF or increase the PHP maximum execution time? When I try to process multiple PDFs I am receiving the error "Maximum execution time of 30 seconds exceeded on line 5404 in ~/httpdocs/vendors/tcpdf/tcpdf.php"
In reading TCPDF's website, it makes the following recommendations to speed things up. Any tips on how to implement any of these that would be useful to Blesta?
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.