Chapter 16. Creating PDFs
This chapter covers
Surprising as it may seem to those of us who spend an unhealthy amount of time in the digital world, there are still people who use and need documents in paper format. Having said that, although clever use of HTML and CSS can produce well-formatted web pages, there are still limits to how pixel-perfect web pages can be, especially when it comes to printing them.
Adobe Systems created the PDF (Portable Document Format) to bridge the gap between printed and digital documents, and it has since become the standard for web-based printable documents, as well as an integral part of a modern graphics workflow. The precision of the PDF format is particularly important for documents such as specifically formatted copies of web page content, emailed invoices, site statistics, and other reports.
In this chapter, we’ll be using Zend Framework’s Zend_Pdf component to generate an example report, and we’ll work through some of its features. But before doing so, we should properly introduce the component, starting with the basics.
Using only PHP, Zend_Pdf allows you to create, load, and save PDF v1.4 documents and provides commands for drawing shapes, text, and images.