I have attached a prototype implementation for #7. Currently, I am
using this to produce a small bit of formatted text on the screen, but
nothing intensive.
This implementation creates cells. Cells can positioned to the left,
right, top, bottom or centered on the X/Y axis. The text within the
cell can be positioned left, right or centered (with future support for
justification).
--Example usage--
<?php
$pdf=new Zend_Pdf();
$pdf->pages[] =new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$font=Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_ITALIC);
$pdf->pages[0]->setFont($font,12);
$cell=new Zend_Pdf_Cell($pdf->pages[0]);
//adds a cell in the upper right with "Hello World"
$cell->addText("Hello World");
$cell->write();
//creates a cell in the center of the page
$cell=new Zend_Pdf_Cell($pdf->pages[0],Zend_Pdf_Cell::POSITION_CENTER_X
| Zend_Pdf_Cell::POSITION_CENTER_Y);
//add a 1 pixel border
$cell->setBorder(1);
//align to the right
$cell->addText("The quick brown fox jumped over the lazy
dog",Zend_Pdf_Cell::ALIGN_RIGHT);
$cell->write();
?>
(I can create a slew of examples for those that want)
--Internal Workings--
When adding text to the cell, it formats it in it's private variable,
$_text. This is a multi dimensional array. The first dimension of the
array is the line number for the text in the cell.
Then, the 2nd diminsion of the line number is either a property for the
line (such as alignment, offset, or width), or a section of text for
that line (key being numerical). These properties are so that you can
have text aligned center on one line of the cell, and aligned on the
left in another line. In each section of text, there is a font, font
size, width and encoding property, with future support for color. This
is so that you can have bolded text with unbolded text in the same line.
I just recently implemented support for borders - so that's proof of
concept. Also the same for word wrapping - just finished proof of
concept code, but still need to test it better before a real release.
When adding text to the cell, it adds it to the internal variable which
gets written to the screen with a call to write().
If you feel that this is a good starting point for #7, I would gladly
sign the contributer agreement and work towards testing and stabilizing
this. Otherwise, I will just use it myself until another implementation
comes along that I can use.
-Logan
Post by Alexander VeremyevYes, #7 is a simplified #12. But they may have completely different API.
So we can implement #7 early and use any appropriate implementation for this.
Another option is to separate a subset of #12 API required for #7. It may take a little bit more time, but produces only one API.
I think first way should be used only if it can be done using really trivial API. For example, if it uses only one additional method (something like drawTextExtended()).
Of course, you are welcome to contribute to it! :)
With best regards,
Alexander Veremyev.
-----Original Message-----
Sent: Thursday, November 01, 2007 11:43 PM
To: Alexander Veremyev
Subject: Re: [fw-formats] Zend_Pdf requirements
As far as #7 and #12, are those the same items? It would seem that #7
is just a simplified #12, and if so, is it the plan to come up with
something simple to get out there for #7 while we wait for #12 to fully
mature?
If so, then I know I had something that had most of #7 already
implemented if anyone was interested.
-Logan
Post by Alexander VeremyevHi all,
I've tried to collect Zend_Pdf functionality requests and bring them
into one list. It's placed in FW wiki now
(http://framework.zend.com/wiki/x/45Y).
Post by Alexander VeremyevI ordered it by a priority I think items should have.
May be something is missing in this list? Or priority should be changed?
Thoughts, comments, suggestions are welcome!
With best regards,
Alexander Veremyev.
No virus found in this outgoing message.
Checked by AVG Free Edition.
30.10.2007 18:26
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.14/1100 - Release Date: 30.10.2007 18:26
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.14/1100 - Release Date: 30.10.2007 18:26