Subject: | Bug with recognizing PDF files via open_scalar |
Date: | Wed, 22 Jul 2015 09:56:23 -0400 |
To: | bug-PDF-API2 [...] rt.cpan.org |
From: | Douglas Early <dearly [...] scenariolearning.com> |
Ran into this bug when attempting to import a large(ish) number of PDFs
stored as scalar data in a databse - about 72 PDFs in all. Most of them
work fine but a few are not recognized as being valid PDFs despite
rendering just fine in browsers or with Acrobat.
The error message is as follows:
*GLOB(0xd837530) not a PDF file version 1.x at
/home/dearly/git-working/document/Document/script/../local/lib/perl5/PDF/API2/Basic/PDF/File.pm
at line 241*
The head of the file (retrieved in the variable buffer) looks like this
*%PDF-1.4 ▒P2 0 obj <</Length 3 0 R /Filter /FlateDecode >> stream*
*Q0T0BC3c#c3▒▒\▒>y*
*endstream endobj 3 0 obj 31 endobj 4 0 obj <</Width 2544 /Height 3300
/BitsPerComponent 1 /Subtype /Image /Type /XObject /ColorSpace/DeviceGray
/Lengf32b8e','8867a55c-5513-4bce-b2dd-700950cee8cb'*
I noticed that removing the $cr variable from the regex on line 240 that
tests for validity allows the file to pass. Perhaps $cr needs amended or
simply removed from the regex patter?
Cheers,
--
Doug EarlySoftware Developer
Scenario Learning
*o. * 800.434.0154
*f. * 513.366.4074
ScenarioLearning.com
<http://scenariolearning.com/> <https://www.facebook.com/scenariolearning>
<https://www.linkedin.com/company/scenario-learning>
<https://twitter.com/SafeSchoolsNews>