ZF-4320: Moving a page between document fails with exception
Description
using the following code: require_once 'Zend/Loader.php'; Zend_Loader::registerAutoload(); echo "
<
pre>"; try { $pdf = Zend_Pdf::load("test/pages.pdf"); $pdfNew = new Zend_Pdf(); $page1 = new Zend_Pdf_Page($pdf->pages[0]); $pdfNew->pages[] = $page1; $pdfNew->save("ttt/p1.pdf"); echo "Done.".PHP_EOL; } catch (Exception $e) { echo $e; }
The following exception is received: exception 'Zend_Pdf_Exception' with message 'Page is attached to one documen, but rendered in context of another.' in /var/www/html/library/Zend/Pdf/Page.php:499 Stack trace:
Comments
Posted by Daniel Hartmann (danielmitd) on 2008-09-24T04:51:32.000+0000
I've got the same problem here. If I want to merge some PDF files like:
$pdf = new Zend_Pdf(); ... $template = new Zend_Pdf("template.pdf", null, true); $pdf->pages[0] = new Zend_Pdf_Page($template->pages[0]);
$pdfPage = new Zend_Pdf_Page(); $pdf->pages[1] = $pdfPage;
is there any plan to implement this?
Posted by Benjamin Eberlei (beberlei) on 2008-11-18T03:32:40.000+0000
From the source code that throws that exception:
I look into it if it can be implemented.
Posted by Benjamin Eberlei (beberlei) on 2008-11-18T03:35:15.000+0000
On first sight, this cannot be implemented in a fast way.
Posted by Oliver Griebl (oliver75) on 2010-10-08T03:45:46.000+0000
We are generating several reports from our database automaticaly with Zend PDF, but are not able to merge different reports into one PDF document or to move pages between documents. Would it be possible that one of the developers of Zend PDF could solve this? We would be gladly willing to give a donation to support zend framework in order to get this issue solved.