convert to PDF: 230 rows=ok, 231 rows = file corrupt

Topics: Developer Forum
Jul 8, 2010 at 2:03 PM
Hi again,

I am having some strange issues writing large data to a PDF-file.

Whenever I generate a PDF with just 10 rows, it works perfectly.
But when I try to upload i.e. 500 rows, the generated PDF-file is suddenly corrupted.
Also, the file-size is suddenly +5k instead of about 300bytes.

Note: I have been testing it to the limit. And that limit is 230 rows.
When trying to insert 231 rows, the file becomes corrupt.

Also a strange thing is, it is working perfect when generating XLSx or CSV.
Is this somehow fix-able?

Best regards, Tim

ps: I am using the latest version
Jul 9, 2010 at 9:15 AM
Edited Jul 9, 2010 at 9:51 AM
Apparently the memory size was overused haha :D

I have no calculations or anything, so it's using quite some memory, for just a little information.
Does anyone have some tricks/tips to reduce the use of memory when writing to PDF?

Best regards,
Tim
Coordinator
Jul 9, 2010 at 9:08 PM

PHPExcel is memory hungry, and some of the writers (HTML and PDF in particular) are excessive in their use of memory. We have already implemented a number of techniques to reduce the memory usage, and I'm looking more closely at the writers to see what further reductions can be made.

In the meanwhile, there is an entire section of the documentation about the cell caching memory saving techniques in PHPExcel (section 4.2.1 of the Developer Documentation)

Jul 9, 2010 at 9:31 PM
Edited Jul 9, 2010 at 9:44 PM
Hi and thank you for your answer Mark!


I also found out something more about the problem that occured

The 230 lines that were written used up more then 32MB of memory (standard max memory?)
The starting solution for me now, is to limit the amount of rows for the PDF and max the amount of memory 'allowed to use' (128MB or more. instead of 32MB)

Anyway, thank you very much! I will look into the documentation you mentioned.
Best regards,
Tim