Issues

ZF-2603: Unknown trailer dictionary key 'DocChecksum' with OpenOffice-made PDF

Description

I opened a document in OpenOffice 2.3, and exported it to PDF with the default values. When I tried to load the PDF document, I got the following exception thrown:

Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'Unknown trailer dictionary key: 'DocChecksum'.' in Zend/Pdf/Trailer.php:53 Stack trace: #0 Zend/Pdf/Trailer.php(68): Zend_Pdf_Trailer->_checkDictKey('DocChecksum')

1 Zend/Pdf/Trailer/Keeper.php(64): Zend_Pdf_Trailer->__construct(Object(Zend_Pdf_Element_Dictionary))

2 Zend/Pdf/Parser.php(335): Zend_Pdf_Trailer_Keeper->__construct(Object(Zend_Pdf_Element_Dictionary), Object(Zend_Pdf_Element_Reference_Context))

3 Zend/Pdf/Parser.php(455): Zend_Pdf_Parser->_loadXRefTable('1197829')

4 Zend/Pdf.php(291): Zend_Pdf_Parser->__construct('system/applicat...', Object(Zend_Pdf_ElementFactory_Proxy), true)

5 Zend/Pdf.php(244): Z in Zend/Pdf/Trailer.php on line 53

How to reproduce: Open OpenOffice v2.3, enter any text, and export to PDF. Then try to load that document using Zend_Pdf.

Suggested fix: Unless you're against adding the DocChecksum key to the $_allowedKeys, I would just add it to it.

Tested on 1.0.2, but pretty sure the problem exists in 1.0.3.

Comments

Updated fix versions

Logan, I don't have OpenOffice on my computer. Can you upload a sample document so I can take a closer look?

The code freeze for 1.5.1 releases is currently scheduled for 21:00 (9:00pm) PST (GMT-8) on Friday, March 21. Would it be possible to address this issue before then? It would be sincerely appreciated :)

I can fix it this week if someone is able to upload a sample document from OpenOffice.

I attached a sample PDF export from an open office document. I have not verified if the error occures with this file.

also attached the source document.

Added "DocChecksum" to the valid trailer dictionary keys. Created ZF-2603 to remove trailer key limitations altogether.

Fixed in trunk and 1.5.1. Please verify and close.

That is, created ZF-2944 to remove trailer key limitations altogether.