PHP Classes

Excellent Tutorial - Which ZF Version?

Recommend this page to a friend!

      PHP Classes blog  >  New approach to gener...  >  All threads  >  Excellent Tutorial - Which ZF Version?  >  (Un) Subscribe thread alerts  
Subject:Excellent Tutorial - Which ZF Version?
Summary:Very good tutorial on a great new approach, ? about ZF version
Author:Keith Hall
Date:2009-10-08 13:59:06
Update:2009-10-09 04:20:00

  1. Excellent Tutorial - Which ZF Version?   Reply   Report abuse  
Picture of Keith Hall Keith Hall - 2009-10-08 19:10:35
Thank you for this very well-written tutorial on generating PDFs with the Zend Framework. This should get folks started quickly.

I have worked with ZF for about 3 years find it is a very robust and powerful collection. The PDF generation documentation has been somewhat lacking at the ZF site but this makes it much clearer.

I have previously used the open source binary HTMLdoc to generate a PDF from an HTML document. This will be nice to introduce some structure and formatting.

One note -- The latest Zend Framework version as of this writing is 1.93PL1. There never was a version 1.10 as they skipped straight from 1.0.4 to 1.5. Were you thinking of the 1.94 or 2.0 release?

  2. Re: Excellent Tutorial - Which ZF Version?   Reply   Report abuse  
Picture of Jonathan Maron Jonathan Maron - 2009-10-09 04:20:00 - In reply to message 1 from Keith Hall
Hello Keith

Generating print-ready well-formatted PDF documents with PHP is not an easy task. Traditionally, there are two main approaches. Given sufficient time and nerves, both partially get the job done, but still leave a lot to be desired.

The HTML-to-PDF approach is widely used in mainstream applications. Here an HTML document is programmatically created and converted to a PDF, using one of the many open source libraries. Since HTML, however, is not a page-oriented format (as is PDF), it is impossible to perform a 1-to-1 mapping between HTML and PDF. Typical word processing file format features, such as header and footers, orphans and widows or even page numbers can simply not be represented in HTML.

The programmatic approach offers total control of the resulting PDF. However, it requires that the x and y coordinates of every line of text, every geometrical shape and graphic be set from program code, such as Zend_PDF. Not only is this an extremely time-consuming solution, but is also very brittle: Every time a graphical designer changes the layout of a document, a programmer must re-work his or her program code.

I am very happy to read that you enjoy using the new template approach.

Currently, Zend Framework is at version 1.9.3PL1. Zend_Service_LiveDocx_* will be in the next version, which is 1.10. Please see the comments from the Zend Framework project leader Matthew Weier O'Phinney.