ZF-7145: Zend_Pdf_Page::drawText() with multi-line text

Description

Hi,

currently Zend_Pdf_Page::drawText() renders provided text within single line, whether provided text is multi-line or not. It would be great if it could handle multi-line text natively.

I quickly implemented it trhough by subclassing drawText() method with following code:


foreach (explode(PHP_EOL, $text) as $i => $line) {
    $page->drawText($line, $x, $y - $i * $page->getFontSize(), $encoding);
}

We could go further and increase flexibility by adding a line-height property on Zend_Pdf_Page and use this value as a line height to center text too.

Regards, Remy

Comments

I think multi-line issues are handled in another bug quite extensively