Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Pdf Component Proposal

Proposed Component Name Zend_Pdf
Developer Notes
Proposers Nico Edtinger
Zend Liaison TBD
Revision 1.0 - 5 May 2009: Initial Draft.
1.1 - 24 June 2009: Added Docblocks.
1.2 - 24 June 2009: Moved to Ready for Review (wiki revision: 7)

Table of Contents

1. Overview

It's currently quite complicated to output text with Zend_Pdf, because the positioning and wrapping of every text piece has to be done manually. Instead this proposal introduces a text cursor and a method to add a text block, which enables to Zend_Pdf to handle the basic text flow operations.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

Most requirements take the form of "foo will do ...." or "foo will not support ...", although different words and sentence structure might be used. Adding functionality to your proposal is requirements creep (bad), unless listed below. Discuss major changes with your team first, and then open a "feature improvement" issue against this component.

  • This proposal will not reengineer Zend_Pdf.
  • This proposal will instead add some new basic methods, that extend the current functionality.
  • This proposal will not hinder reengineering Zend_Pdf. Everything that gets added is an API improvement, designed from a component user point of view.
  • The new methods will be optional.
  • Therefore, Zend_Pdf will stay completely backward compatible.

4. Dependencies on Other Framework Components

  • Zend_Pdf

5. Theory of Operation

The basic method to add text is still drawText(), but the parameters $x and $y will be optional, if a text cursor is set. The cursor runs from left to right or right to left. Every time a new text fragment is drawn the cursor advances automatically. If a width is set, the cursor will automatically add a new text line wrapping words as needed. It's possible to change the text style between text fragments.
In addition a new method drawTextBlock() is added that allows drawing text left or right aligned, centered or justified. The later two alignments are only possible with this method, but the whole text block can only have one text style.

6. Milestones / Tasks

  • Milestone 1: design notes will be published here [DONE]
  • Milestone 2: Published working prototype.
  • Milestone 3: Working prototype checked into the incubator.
  • Milestone 4: Unit tests exist, work, and are checked into SVN.
  • Milestone 5: Initial documentation exists.

7. Class Index

  • Zend_Pdf
  • Zend_Pdf_Page

8. Use Cases


9. Class Skeletons



Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jul 02, 2009

    <p>I've uploaded what I currently have:</p>
    <td><p>new Zend/Pdf/Page.php with text drawing improvements</p></td>
    <td><p><a href=""></a></p></td>
    <td><p>diff to last SVN rev</p></td>
    <td><p><a href=""></a></p></td>
    <td><p>test file</p></td>
    <td><p><a href=""></a></p></td>
    <td><p>source of test file</p></td>
    <td><p><a href=""></a></p></td>

  2. Jan 22, 2010

    <p>Any news on this proposal? Looks useful to me. <ac:emoticon ac:name="smile" /></p>

  3. Sep 24, 2011

    <p>Nice proposal! I am certainly going to use this and would like to see it in Zend. However, I found a small bug I think.</p>

    <p>The method drawTextBlock has a reference to the variable widht. This should probably be $width?</p>