Added by Nico Edtinger, last edited by Nico Edtinger on Jun 24, 2009  (view change) show comment

Labels

 
(None)

Zend Framework: Zend_Pdf Component Proposal

Proposed Component Name Zend_Pdf
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Pdf
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: 6)

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

UC-01

UC-02

9. Class Skeletons

Any news on this proposal? Looks useful to me.