This looks awesome!
I would really be happy if you would propose that as an addition to the ZF. :)
You have to sign the CLA and then make a proposal on the Proposal Wiki
http://framework.zend.com/wiki/display/ZFPROP
What about arrays or Iterators and simple IF statements. Are they supported or
could they be implemented? That would make the solution very powerful.
On the blog you only show DocX examples, how are Doc and Rtf supported?
greetings,
Benjamin
On Thursday 29 January 2009 10:02:50 Jonathan Maron wrote:
Hello all
Zend_Pdf is a great component to generate PDF files with ZF. If you
want to populate PDF templates with text, however, it can be very time
consuming to get the positioning of the text fields just right. I
wrote about this issue here:
http://tinyurl.com/bym43f
After having developed several ZF applications in which text had to be
inserted into PDF templates, I knew there must be a better way and
went about developing one.
The result is a project called phpLiveDocx, which is an unofficial
component for ZF. (If it were to become official component some day, I
would be thrilled.)
The idea is really simple:
1. You design a template in a word processing package (such as Open
Office or Word). In the template, you define any number of text
fields, into which data will be later inserted (same idea as
mail-merge).
2. Using phpLiveDocx, you assign data to the template.
3. You generate and save the populated document as a PDF, DOCX, DOC or RTF
file.
The great advantage of this approach is that you uncouple the
formatting of the template and the position of the text fields. In
other words, should a designer change the layout of a template, there
is no need for a developer to update the positioning of the text
fields.
Of course, the other great advantage is that you can save the
resulting document as DOCX, DOC or RTF, in addition to PDF.
Here is a really basic example, which illustrates how phpLiveDocx works:
http://tinyurl.com/ao9c2v
(The template and resulting document can be download from the bottom
of the post.)
Here is a very short getting started guide and download links:
http://tinyurl.com/db23fc
If you need any help or want to talk about phpLiveDocx, just follow up
here or post me a message:
http://tinyurl.com/culdpj
Thank you
Jonathan Maron
http://www.phpLiveDocx.org
--
Benjamin Eberlei
http://www.beberlei.de