PDF Writer hangs while loading

Topics: Developer Forum
Feb 28, 2011 at 6:40 PM

Hello, we have been using PHPExcel for some time and have really enjoyed its combination PDF and Excel capabilities.

We would like to submit the following bug:  When upgrading from version 1.7.3c to version 1.7.6, PDF generation for one of our sites either has a serious memory leak or is consuming an enormous amount of memory.  When I use the Excel5 writer, everything appears correctly.  In the version 1.7.3c, it appeared correctly with both the PDF and the Excel writers.

After some slight debugging, I was able to determine that using setRowsToRepeatAtTopByStartAndEnd(1, 6) is causing the hangup.  Removing that line allowed the PDF to generate.  Additionally, I cannot remove a default border of a very thick black outline on each of the cells that are having data pushed into them.  Trying to run $objPHPExcel->getActiveSheet()->getStyle()->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_NONE); seems to do nothing to the cells with actual data in them.

I reviewed the changelog and did not immediately see anything that would be pertinent.  I'm not sure if I'm doing something wrong or if this is an actual bug with the release.

I am using PHP 5.3.1 and have Adobe Reader 9 and Microsoft Office Excel 2010 installed.  My machine is Windows 7, running WAMP Server 2.0.

Any thoughts?  Thanks!


Feb 28, 2011 at 8:49 PM

You're right: there are a lot of problems with the PDF Writer; and every attempt to fix one problem creates half a dozen more.

PHPExcel uses the third-party tcPDF library, which is excessively bloated, eats memory, and doesn't produce a good display. Reverting the tcPDF library to an earlier version may resolve some problems, but cause others.

For the future, I'm planning to remove the bundled tcPDF completely, and allow PHPExcel to be configured to use alternative libraries such as DomPDF or mPDF. I've posted some comments about that in this thread which mentions some of the pros and cons of each library, though I've not had much feedback as yet.