SuiteCRM Print as PDF Shows Blank White Page

SuiteCRM print as pdf shows blank white page

I am using SuiteCRM and suddenly when I try to generate pdf, it shows blank white page. Same functionality was working fine for years and there is no change in SuiteCRM or server.

I tried to search within SuiteCRM log available at SuiteCRM ROOT > suitecrm.log and PHP log but it did not contain any information.

Finally I decided to explore uncharted territory of going through the PHP code responsible for generating PDF file. I know PHP but I don’t know the internal details of this SuiteCRM and yet took a plunge and found the following.

Identify the Root Cause of Blank White Page

Go to SuiteCRM ROOT > modules > AOS_PDF_Templates

Open file generatePdf.php

Around line 46, you will see “error_reporting(0);”. It suppresses any error generated from this page. It is possible that developer may have good intent to suppress the error but I would rather have error details logged/visible rather than suppressed. Comment out this line. The current line suppresses any errors that you may get and hence it is not possible to find the root cause of the error.

Once you comment out the line and try to generate PDF, now it will log the exact error you would get within suitecrm.log file

My Root Cause for Blank White Page

I had the page working earlier without any issue. I had no code or server side change so it was difficult to figure out.

Once I commented the above mentioned line, it showed the following error.

Allowed memory size of 33554432 bytes exhausted (tried to allocate 299008 bytes)

This means that PHP is allowed only 32MB. I looked at various places like .ini and .htaccess file but everywhere the limit was set to 128MB.

Finally I figured out that PHP is running as FPM and hence the config file is available at /etc/php/7.4/fpm/pool.d/some_random_number.conf file.

When I opened the file, it showed that the limit was set to 32MB.

I changed it to 128MB. I stopped FPM and Apache service and started it again. (and not restarted).

The issue is fixed and now my PDF files are generated without any issue.



Leave a Reply

Your email address will not be published. Required fields are marked *