Merge PDFs with the Zend Framework
28 Aug 2013
I’ve used a number of PHP libraries to handle creation of PDFs but only
recently needed to merge existing PDF files via PHP.
There are a couple of existing libraries to handle this, the previously popular pdfmerger
script at codeplex has become unmaintained. Currently using the Zend Framework is the best way to
Using the PDF component of the Zend Framework is suprisingly easy, just load in the PDFs, clone the pages
and save as a new PDF (or display in the browser).
Here’s the code to merge 2 existing PDFs. Its easy enough to add more PDFs or dynamic content using
Zend PDF or tcpdf
Note: This is using Zend Framework version 1
PDF merge with Zend - pdf_merge_zend.pph