Before you start
This tutorial is for developers who want to learn more about generating PDF files using the PHP Zend Framework. It discusses the overall framework and provides an example of generating new and edited documents. This functionality will be integrated into the existing Chomp feed reader created earlier in this series.
This "Understanding the Zend Framework" series chronicles the building of an online feed reader, Chomp, while explaining the major aspects of using the recently introduced open source PHP Zend Framework.
Part 1, talked about the overall concepts of the Zend Framework, including a list of relevant classes and a general discussion of the MVC pattern. Part 2 expanded on that to show how MVC can be implemented in a Zend Framework application. You also created the user registration and login process, adding user information to the database and pulling it back out again.
Parts 3 and 4 dealt with the actual RSS and Atom feeds. In Part 3, you enabled users to subscribe to individual feeds and to display the items listed in those feeds. You also discussed some of the Zend Framework's form-handling capabilities, validating data, and sanitizing feed items. Part 4 explained how to create a proxy to pull data from a site that has no feed.
The rest of the series involves adding value to the Chomp application. Here in Part 5, you will look at using the PDF format as a type of backup for saved entries. Part 6 uses the Zend_Mail module to alert users to new posts.
Part 7, looks at searching saved content and returning ranked results. In Part 8, you create your own mashup, adding information from Amazon, Flickr, Twitter and Yahoo! And in Part 9, you add Ajax interactions to the site using JavaScript object notation.
In earlier parts of this "Understanding the Zend Framework" series, you created the basic Chomp online feed reader.
In this tutorial, you will provide a way for the user to create a PDF file of his favorite feed entries. The user can then download the PDF as a backup or as a more convenient way to print out multiple entries to read later.
You'll start by creating a basic PDF document using the Zend_PDF component of the Zend Framework, enabling you to see the general concepts behind creating a document, adding text and graphics, and more. You will then look at integrating this functionality with the application.
To do that, you will first make it possible to save descriptions to the savedentries table, which previously held only full text (web page) entries. This will make them available for adding to the PDF document. You will then look at creating a new PDF document from within the feed controller and adding actual live data to it. You will also look at solving several issues that arise from the lack of features that are often taken for granted, such as word wrapping at the end of a line.
In this tutorial, you will take the existing code from Part 4 and enable the user to save his existing saved entries in a single PDF document, which can be read offline or printed.
This tutorial assumes that you have a good familiarity with PHP programming and at least a basic understanding of how the Model-View-Controller (MVC) pattern works (see Resources). You do not have to know what the format of a PDF document looks like; the whole point of the Zend_PDF component is to insulate you from that depth of involvement with your data.
See Part 2 of this series for details on installing the Zend Framework and XAMPP, the easy-to-install version of Apache, MySQL, and PHP rolled into one.

