ZF-5832: removing pages from a Zend_Pdf's pages[] array causes some PDF readers to issue warning

Issue Type: Docs: Improvement Created: 2009-02-18T15:41:11.000+0000 Last Updated: 2009-08-26T07:48:27.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Charles Hoffman (nothinghappens) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Pdf

Related issues: Attachments:


Zend_Pdf, 37.4.2 (…) gives an example of cloning a page and using it as a template for other pages and then removing the template page. To remove the template page, the example code is


I'm noticing that the documents in which I am using this technique, when opened in Adobe Acrobat, cause a warning message: "The document's page tree contains an invalid node." I suspect that the gap left in the indices of the Zend_Pdf pages[] property by removing pages in this way is causing a null, "invalid" page in the document. Perhaps it would be better for the example to use:

array_splice($pdf>pages, $templatePageIndex, 1);


Posted by Leonardo Piseri ( on 2009-02-20T06:36:55.000+0000

I'm noticing the same behaviour also using the proposed array_splice method.

Posted by Charles Hoffman (nothinghappens) on 2009-02-21T10:17:12.000+0000

Darn. I thought that might do it since it wouldn't leave a gap in the array indices, but hadn't had a chance to try it out as I didn't have a Windows box handy to try and open the resulting file in AA. It's too bad because the document views and prints fine after issuing the warning, but the warning seems seems to freak people out a little.

Posted by Blue (bluescorpion) on 2009-04-20T00:45:44.000+0000

For me, the same error. Would like the error as quickly as possible to have resolved.

Posted by Michael Raschke (michael.bln) on 2009-04-20T02:21:12.000+0000

The same problem occurs after overwriting a page:

$pdf = Zend_Pdf::load('pdf/xyz.pdf'); $template = $pdf->pages[0]; $page = new Zend_Pdf_Page($template); $pdf->pages[0] = $page;

This should be the alternative to: $pdf = Zend_Pdf::load('pdf/xyz.pdf'); $template = $pdf->pages[0]; $page = new Zend_Pdf_Page($template); $pdf->pages[1] = $page;


But the same warning appears!!

Posted by Alexander Veremyev (alexander) on 2009-05-15T11:22:22.000+0000

Problem appears if deleted page is referred by document open action attribute or within bookmarks (and probably in some other places).

Posted by Alexander Veremyev (alexander) on 2009-08-26T07:48:27.000+0000

Fixed for ZF 1.9.0

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.