pauln / tcpdi_parser

Parser for use with TCPDI, based on TCPDF_PARSER
GNU Lesser General Public License v3.0
27 stars 47 forks source link

PHP Fatal error: Allowed memory size of ... bytes exhausted #8

Closed Stupi closed 8 years ago

Stupi commented 8 years ago

Hello Paul,

can you help me with this issue. I have problem with parsing of pdf file below: PHP Fatal error: Allowed memory size of ... bytes exhausted. Version of pdf file is 1.3. https://drive.google.com/file/d/0BzI_iKD4AN2aSGpDeTVjZjI2dms/view?usp=sharing.

Thank you for your help.

pauln commented 8 years ago

Hi @Stupi, Your sample file seems to work just fine for me. You've removed the memory limit from the fatal error line - what's your PHP memory_limit set to?

Stupi commented 8 years ago

Hi @pauln,

I changed text in this pdf file over FPDI library and PDF File is now parseable with your tcpdi_parser. I can't send you original pdf file because it's pdf file of some company. I will try to find some solution how to change text and this issue with memory will be throw.

pauln commented 8 years ago

Ah, that makes things a little tricky, @Stupi. If you're unable to generate a PDF with safe-to-share test data in it directly from the system, would you be able to email me an affected PDF privately (my github username at next.gen.nz)? If so, I'll use it only to identify the issue, and then dispose of it.

Stupi commented 8 years ago

I have found one pdf file with this issue. https://drive.google.com/file/d/0BzI_iKD4AN2aLUR6NUVMMl85Mjg/view?usp=sharing

pauln commented 8 years ago

@Stupi, thanks for providing the sample PDF. The parser was incorrectly attempting to extract a stream which was actually part of an embedded PDF; the failed extraction caused it to get stuck. I've just pushed a commit which should fix this issue - can you please try it on your other affected PDFs and confirm whether the issue is now resolved?

Stupi commented 8 years ago

@pauln , yes it starts work for this pdf file, but I have found another pdf file which has the same issue. Here is example: (this pdf file is generated by Microsoft Reporting Services PDF Rendering Extension 10.0.0.0 and version of pdf file is 1.3. Here is url where you can generate sample pdf file: http://www5.rptea.com/ReportViewer2Pdf/) https://drive.google.com/file/d/0BzI_iKD4AN2aT1BkMU9PV2wwZ0k/view?usp=sharing

pauln commented 8 years ago

@Stupi, I've pushed another commit which should fix your ReportViewer PDFs. For some reason, it's got extra spaces in some unexpected places, which had a similar effect to the embedded PDF issue. I'll close this issue now - if you encounter any other PDFs which don't work, please open a new one.