Page 1 of 1

Solved: TCPDF errors - Empty pdf

Posted: 10 Feb 2014, 01:29
by Jimmuk
Hi Jan,

I am having problems displaying a pdf and have set error reporting on to get an idea of the problem.

The pop up appears but is blank.

With error reporting I get this:
Strict Standards: Non-static method PhocaPDFRender::renderPDF() should not be called statically, assuming $this from incompatible context in /home/sites/spiderswebpub.co.uk/public_html/libraries/joomla/document/pdf/pdf.php on line 96 Strict Standards: Only variables should be assigned by reference in /home/sites/spiderswebpub.co.uk/public_html/administrator/components/com_phocapdf/helpers/phocapdfrender.php on line 105

Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 71 bytes) in /home/sites/spiderswebpub.co.uk/public_html/administrator/components/com_phocapdf/assets/tcpdf/encodings_maps.php on line 637

I have set the memory limit to 40Meg but still get this error. I am going to contact my server host to ensure the setting is at 40Meg - the error seems to suggest it is still at 24Meg.

What is the issue with Strict standards and is this a problem? re: PhocaPDFRender::renderPDF()

Additionally when I view the phocapdf plugin I cannot view the header - I can see the settings for 'site', 'footer' and 'pdf' but nothing shows for header. this is the same for both 'content' and 'restaurant menu'.

regards,
Jimmuk

SOLVED: TCPDF errors

Posted: 10 Feb 2014, 02:33
by Jimmuk
Hi Jan,

Got it working now - been at this for days now and finally got a break :|

For others having a similar issue it is memory related. See this article I found which helped me.

"...PHP has a built-in limit on the amount of memory it will allocate. If that limit is reached, the process will exit with this error message. This is usually the result of the PHP script trying to load a large file, such as an image, into memory all at once. While it is better if you can arrange for the script not to do such things, it is also possible to increase the memory limit to avoid this problem. To do that, edit (or create in your script's folder if it does not exist) the php.ini file with your PHP scripts (create it if it does not exist) and add the following line:
memory_limit=32M

You should replace the '32' with whatever value is appropriate. The default is 32M (32 megabytes)

If you are using PHP 5.3, you may also need to check for .user.ini files in the same directory which may be overriding your settings.
If this does not resolve the problem, you can also increase the web server memory limit by editing (or creating in your script's folder if it does not exist) the ".htaccess" file and adding the following line:
RLimitMem max

Both php.ini and .htaccess files should be created in plain text (for example with Notepad on Windows, or TextEdit in Plain Text mode on a Mac) to avoid any formatting information being saved. Rich text editors such as WordPad, MS Word, and TextEdit in its default Rich Text mode will produce unreadable files.."


In my case I had three files in my root for the Joomla package:
.user.ini
php.ini
php5.ini

I had modified the last two but failed to spot the user.ini until I seen the article above.

By setting the memory limit to 40M instead of 24M the problem was solved. I tried the .htaccess fix but this turned out to be unnecessary and I later removed this. Simply changing .user.ini was sufficient.

I hope this helps someone else..

regards,
Jimmuk

Re: Solved: TCPDF errors - Empty pdf

Posted: 11 Feb 2014, 13:08
by Jan
Hi, thank you for the guide.

Jan