setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10); $page->setStyle($style); // normal text drawing $page->drawText('Draw text to 50, 750', 50, 750); $page->drawText('Draw text to 200, 750', 200, 750); $test_text = array( 'This is a test text.', 'This is a test text.', 'This is a test text.', 'This is a test text.', 'This is a test text.', 'This is a test text.', 'This is a test text.', ); // draw text as block with different alignments $page->drawTextBlock(implode(' ', array('text block left aligned:') + $test_text), 50, 700, 90, null, Zend_Pdf_Page::ALIGN_LEFT); $page->drawTextBlock(implode(' ', array('text block right aligned:') + $test_text), 150, 700, 90, null, Zend_Pdf_Page::ALIGN_RIGHT); $page->drawTextBlock(implode(' ', array('text block centered:') + $test_text), 250, 700, 90, null, Zend_Pdf_Page::ALIGN_CENTER); $page->drawTextBlock(implode(' ', array('text block justified:') + $test_text), 350, 700, 90, null, Zend_Pdf_Page::ALIGN_JUSTIFY); // draw text with cursor and automatic wrapping with different styles $style_bold = new Zend_Pdf_Style(); $style_bold->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10); $style_italic = new Zend_Pdf_Style(); $style_italic->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_ITALIC), 10); $styles = array($style, $style_bold, $style_italic); $page->setTextCursor(50, 550); $page->setTextCursorWidth(150); $page->setStyle($style_bold); $page->drawText('text with cursor: '); for ($i = 0; $i < 3; ++$i) { foreach ($test_text as $line) { $page->setStyle($styles[rand(0, 2)]); $page->drawText($line . ' '); } } // save $pdf->pages[] = $page; header('Content-Type: application/pdf'); echo $pdf->render();