ZF-9824: PDF file syntax error

Description

I'm able to open the PDF using my PDF viewer (Preview, Mac OS X), but get the following exception when I try to open it using Zend_Pdf.

{{Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'PDF file syntax error. Offset - 0xEBDF2. Wrong W dictionary entry. Only type field of stream entries has default value and could be zero length.' in [...]/Zend/Pdf/Parser.php:236 Stack trace:

0 [...]/Zend/Pdf/Parser.php(452): Zend_Pdf_Parser->_loadXRefTable('966130')

1 [...]/Zend/Pdf.php(303): Zend_Pdf_Parser->__construct('../tmp/pdf/test...', Object(Zend_Pdf_ElementFactory_Proxy), true)

2 [...]/Zend/Pdf.php(253): Zend_Pdf->__construct('../tmp/pdf/test...', NULL, true)

3 /U [?] in [...]/Zend/Pdf/Parser.php on line 236}}

General information provided by Preview: - PDF-Version: 1.5 - PDF created by: Acrobat Distiller 9.0.0 (Windows)

Comments

Using 1.11.2 I get the following error:

Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'PDF file syntax error. Offset - 0x74. Wrong W dictionary entry. Only type field of stream entries has default value and could be zero length.' in [...]/Zend/Pdf/Parser.php:236 Stack trace:

0 [...]/Zend/Pdf/Parser.php(460): Zend_Pdf_Parser->_loadXRefTable('116')

1 [...]/Zend/Pdf.php(309): Zend_Pdf_Parser->__construct('options.pdf', Object(Zend_Pdf_ElementFactory_Proxy), true)

2 [...]/Zend/Pdf.php(259): Zend_Pdf->__construct('options.pdf', 1, true)

3 [...]/index.php(18): Zend_Pdf::load('options.pdf', 1)

4 {main}

thrown in [...]/Zend/Pdf/Parser.php on line 236

General information provided by Preview:

PDF-Version: 1.6 PDF Producer: Adobe Acrobat 10.0 Image Conversion Plug-in PDF creator: Adobe Acrobat 10.0

Note in manual says that it's OK with PDF version 1.4 not sure for 1.6 - http://framework.zend.com/manual/en/…

Unfortunately, cross-reference streams are not supported yet. The question is how often such documents may occur? (the implementation is not too complex, but should take some time)

I seem to run into problems because of lack of PDF 1.5+ support regularly, although I'm not sure this is caused by cross-referenced streams. My users have to manually convert the PDF to 1.4 in Acrobat to ensure no problem, and I'd really like to avoid troubling them with this.

I'm willing to do some of this work Alexander, if you'd be willing to help get me started, maybe some occasional help and review my code.

This is severely impacting me. This issue applies to every one of the PDF files I need to use this with. These are PDF files created from InDesign.