First released in 1993, Adobe’s Portable Document Format (PDF) is now ubiquitous. It’s a great way to create printable documents that work across multiple platforms without any loss of fidelity, and it also supports interactive features like bookmarks, annotations and forms.
PHP comes with a number of options to help developers dynamically generate PDF files from within their applications. The Haru and PDFlib extensions offer a complete API for dynamic PDF generation, and there also exist a number of open-source PHP components that can be used for the same purpose. This article will introduce you to one such component, the Zend_Pdf component that ships as part of the Zend Framework, and illustrate how it can be used to perform sophisticated PDF operations from within a PHP application.
The Name Of The Rose
Before diving into the code, a few notes and assumptions. I’ll assume throughout this article that you have a working Apache/PHP/MySQL development environment, and that you have downloaded and installed the latest version of the Zend Framework. I’ll also assume that you know the basics of working with classes and objects in PHP.
The Zend_Pdf component is a “pure PHP” implementation of the PDF standard, and no external libraries are required to use it. This can come in handy when operating in a shared hosting environment that does not allow individual access to custom extensions. The component supports most common PDF operations, including adding and deleting pages; inserting text and images on pages; drawing and colorizing shapes; and updating document meta-data.
Read full Article Here