ZF-449: Copy Pages from one document into another


When I try to render a page from one PDF into another, new PDF, I get the following exception: "Page is attached to one documen, but rendered in context of another." The corresponding code in Page.php on line 427 tells me, that cloning has to be implemented instead of this exception. Is anyone actually working on this and if so is there a release date? I need that function to build a new PDF from several pages of other PDFs.


Changing fix version to 0.6.0.

Need "deep copy" implementation for PDF objects

Postponed to post-1.0 period

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Are you serious about this? As far as I could see, this shouldn't be a huge change, and now this is hanging around since 0.6?

In my opinion it is not majo anymore, but a blocker. This is one thing among others which prevents me from using Zend_Pdf. Yet FPDF with FPDI are the only good open source option for creating more complex PDFs. If such simple things won't be fixed, you could kinda delete Zend_Pdf to make the Framework more lightweight without any loss. Just my two cents.

Happy 2-nd birthday to this blocker. You should change the estimation from 4 days to 4 years.

Unassigning Zend_Pdf issues currently assigned to me pending decision on ZF 2.0 release timeframe and potential contribution of comprehensive changeset.

@Ben Do you have a patch to submit? @Alex Please evaluate. If this is an issue that we will not address before 1.8, please mark it 'postponed'. We should keep in mind that it has several votes, however, and prioritize it for post-1.8.

This issue is a major pain in the butt, it makes dynamic pdf file generation beyond the simple cases difficult.

Im generating reports, a report is a document with lots of variable length sections, I need to be able to have a second pdf doc open with templates for the various page types we use in the report, and be able to create new pages in my report document from the templates as we move through the report generation.

The lack of either of the two following functions makes this a pain.

1) Clone a page from another doc into the current doc as a new page.


2) Create a new page in the current document from an existing PDF file (like the "Zend_Pdf:;Load()" function).

Either would sort out my issue.

only workaround is to use TCPDF ( and instead of Zend !

I already use TCPDF for PDF generation. Hi ZF guys, you should really consider to abandon Zend_Pdf, because it's development stagnates in last 2 years.

Has there been any progress on this? I'm still having this problem as of ZF 1.9

Does anyone know how this one will be supported? Please implement this functionality!

The remark about, changing from 4 days to 4 years is getting more and more true. Can the maintainer of this part of the framework shed a bit of light on this (and a lot of other PDF related) issue(s).

I would like even be able to copy a page from within a document - so i can create a base page and duplicate it.

... at least within a pdf document it already works fine with cloning a page (…)

I'm proud to inform, that it's done and will be included into ZF 1.11 :)

Four years is really longer than four days :), but there were some additional difficulties.

congratulations :)

After this fix, there is a small error:

Parse error: syntax error, unexpected T_VARIABLE in Zend/Pdf/Resource.php on line 93

The const CLONE_MODE_FORCE_CLONING is just in the function placed. Please remove it.