Chapter 40. Zend_Pdf

Table of Contents

40.1. Introduction
40.2. Creating and Loading PDF Documents
40.3. Save Changes to PDF Documents
40.4. Working with Pages
40.4.1. Page Creation
40.4.2. Page cloning
40.5. Drawing
40.5.1. Geometry
40.5.2. Colors
40.5.3. Shape Drawing
40.5.4. Text Drawing
40.5.5. Using fonts
40.5.6. Standard PDF fonts limitations
40.5.7. Extracting fonts
40.5.8. Image Drawing
40.5.9. Line drawing style
40.5.10. Fill style
40.5.11. Linear Transformations
40.5.11.1. Rotations
40.5.11.2. Starting from ZF 1.8, scaling
40.5.11.3. Starting from ZF 1.8, translating
40.5.11.4. Starting from ZF 1.8, skewing
40.5.12. Save/restore graphics state
40.5.13. Clipping draw area
40.5.14. Styles
40.5.15. Transparency
40.6. Document Info and Metadata
40.7. Zend_Pdf module usage example

40.1. Introduction

The Zend_Pdf component is a PDF (Portable Document Format) manipulation engine. It can load, create, modify and save documents. Thus it can help any PHP application dynamically create PDF documents by modifying existing documents or generating new ones from scratch. Zend_Pdf offers the following features:

  • Create a new document or load existing one. [2]

  • Retrieve a specified revision of the document.

  • Manipulate pages within a document. Change page order, add new pages, remove pages from a document.

  • Different drawing primitives (lines, rectangles, polygons, circles, ellipses and sectors).

  • Text drawing using any of the 14 standard (built-in) fonts or your own custom TrueType fonts.

  • Rotations.

  • Image drawing. [3]

  • Incremental PDF file update.



[2] Loading PDF V1.4 (Acrobat 5) documents is now supported.

[3] JPG, PNG [Up to 8bit per channel+Alpha] and TIFF images are supported.