File_PDF not displaying correctly inline

From: Date: Mon, 11 Dec 2006 14:51:20 +0000
Subject: File_PDF not displaying correctly inline
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-45155@lists.php.net to get a copy of this message
Hello, I have been trying to use File_PDF recently to generate reports from a database and have come up with a strange situation. Until I finished testing the generation format, etc. I was only generating a report with 1 or 2 pages (i.e. 1 or 2 results). The other day I finished the first phase, and decided to make sure that I could create a report with multiple (i.e. > 5) results. It seemed as I got above 4 results, the PDF document would not display inline. I thought this was a bug in my code so I spent several hours digging around trying to figure out what the problem was. There were no error messages, either on the web page or in the error log. For testing, I was using Acrobat Reader 7.0.8, Firefox 2.0 on Windows XP with File_PDF 0.1.0. The PDF page would open (new window) and the menu bar at the top would state that the document was application/pdf, which is correct. However, the Adobe Acrobat plugin bar would not show up and the page would be blank. Also, the window that the PDF was supposed to show up in would appear to be relatively frozen (i.e. putting another window over it and then moving it away would give you that "shadow" effect of seeing the second window's contents left behind in the frozen window). I could close the window without a problem, but the frozen aspect seems to say that the plugin is having some issues. As I could not make the script generate any errors, I was at a complete loss as to how to diagnose the problem. My guess would be that for some reason files generated over a certain size were causing the problem, either by not being interpreted correctly by the plugin or not being sent fully from PHP. I eventually fixed the problem by changing the document from inline to non-inline, forcing me to save the PDF every time it is generated. As soon as I did this, I was able to run reports of close to 70 results without issue and with great speed. Therefore, it seems to be something having to do with how the plugin interprets or receives the PDF and not the actual PDF generation itself, as that seems to work absolutely perfectly. Here's the code I am using to send the PDF off to the browser: $pdf_len = strlen($pdf->getOutput()); header('Cache-Control: no-cache'); header('Pragma: no-cache'); header('Content-Length: ' . $pdf_len); $pdf->output('thefile.pdf', true); I have also tried removing all the header calls and just executing the output() call, but that has not fixed the problem. As I said, I have found a solution for my needs, but I figured this may be a problem others may have in the future, but I wasn't sure if I could classify it as a "bug" as I don't have any clue what the problem could be (it could very well be a bug in the Acrobat plugin and not in File_PDF). Thanks for any help you can offer.

« previous php.pear.dev (#45155) next »