开发者

Zend Pdf. Writing Text into a cell. Any MultiCell() function in Zend?

I'm trying to write text to a pdf. But if the text is long enough it overflows from the page. Is there any way to write text into a text box.For fPdf there is a MultiCell() function. Is there any such开发者_运维问答 function in Zend?


I ran into the same problem and had to write my own solution using php's wordwrap() function. I took the output from that and then did a explode($output, "\n") and looped over the resulting array to print each line with Zend_Pdf_Page::drawText()


I wrote a text wrapper for zend's pdf and table generator as well. But there are other extensions in the ZF tracker as other people have proposals that are not excepted into the main ZF distro, meh politics in code really is a damper.

http://www.gorilla3d.com/v8/zend-pdf-text-wrapping-and-tables?article_group_id=5

$pdf = new Zend_Pdf();
$page = new Gorilla_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER); 
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER); 

//-- Header
$page->setFont($font, 24);
$page->drawMultilineText(array('Purchase Order'), 390, 48);


@mark Instead of the wordrap() PHP function, it's even better to use Zend_Text_MultiByte::wordWrap() because it is multibyte save.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜