public function testDrawing() { $pdf = new Zend_Pdf(); // Add new page generated by Zend_Pdf object (page is attached to the specified the document) $pdf->pages[] = $page1 = $pdf->newPage('A4'); // Add new page generated by Zend_Pdf_Page object (page is not attached to the document) $pdf->pages[] = $page2 = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE); // Create new font $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); // Apply font and draw text $page1->setFont($font, 36); $page1->setFillColor(Zend_Pdf_Color_Html::color('#9999cc')); $page1->drawText('Helvetica 36 text string', 60, 500); // Use font object for another page $page2->setFont($font, 24); $page2->drawText('Helvetica 24 text string', 60, 500); // Use another font $page2->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES), 32); $page2->drawText('Times-Roman 32 text string', 60, 450); // Draw rectangle $page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8)); $page2->setLineColor(new Zend_Pdf_Color_GrayScale(0.2)); $page2->setLineDashingPattern(array(3, 2, 3, 4), 1.6); $page2->drawRectangle(60, 400, 400, 350); // Draw circle $page2->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID); $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0)); $page2->drawCircle(85, 375, 25); // Draw sectors $page2->drawCircle(200, 375, 25, 2 * M_PI / 3, -M_PI / 6); $page2->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0)); $page2->drawCircle(200, 375, 25, M_PI / 6, 2 * M_PI / 3); $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0)); $page2->drawCircle(200, 375, 25, -M_PI / 6, M_PI / 6); // Draw ellipse $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0)); $page2->drawEllipse(250, 400, 400, 350); $page2->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0)); $page2->drawEllipse(250, 400, 400, 350, M_PI / 6, 2 * M_PI / 3); $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0)); $page2->drawEllipse(250, 400, 400, 350, -M_PI / 6, M_PI / 6); // Draw and fill polygon $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1)); $x = array(); $y = array(); for ($count = 0; $count < 8; $count++) { $x[] = 140 + 25 * cos(3 * M_PI_4 * $count); $y[] = 375 + 25 * sin(3 * M_PI_4 * $count); } $page2->drawPolygon($x, $y, Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE, Zend_Pdf_Page::FILL_METHOD_EVEN_ODD); // Draw line $page2->setLineWidth(0.5); $page2->drawLine(60, 375, 400, 375); $pdf->save(dirname(__FILE__) . '/_files/output.pdf'); unset($pdf); $pdf1 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output.pdf'); $this->assertTrue($pdf1 instanceof Zend_Pdf); unset($pdf1); unlink(dirname(__FILE__) . '/_files/output.pdf'); }
$page->drawText('Modified by Zend Framework!', 150, 0) ->restoreGS(); } // Add new page generated by Zend_Pdf object (page is attached to the specified the document) $pdf->pages[] = ($page1 = $pdf->newPage('A4')); // Add new page generated by Zend_Pdf_Page object (page is not attached to the document) $pdf->pages[] = ($page2 = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE)); // Create new font $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); // Apply font and draw text $page1->setFont($font, 36) ->setFillColor(Zend_Pdf_Color_Html::color('#9999cc')) ->drawText('Helvetica 36 text string', 60, 500); // Use font object for another page $page2->setFont($font, 24) ->drawText('Helvetica 24 text string', 60, 500); // Use another font $page2->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES), 32) ->drawText('Times-Roman 32 text string', 60, 450); // Draw rectangle $page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8)) ->setLineColor(new Zend_Pdf_Color_GrayScale(0.2)) ->setLineDashingPattern(array(3, 2, 3, 4), 1.6) ->drawRectangle(60, 400, 400, 350);
/** * @see Pimcore_Image_Matrixcode_Renderer_Abstract::_renderMatrixcode() */ protected function _renderMatrixcode() { $padding = $this->_matrixcode->getPadding(); $this->_matrixcode->draw(); $matrix_dimension = count($this->_matrixcode->getMatrix()); $matrix_dim_with_padding_x = $matrix_dimension + $padding[1] + $padding[3]; $matrix_dim_with_padding_y = $matrix_dimension + $padding[0] + $padding[2]; // Scaling $scale = $this->getScale(); $output_size_width = $matrix_dim_with_padding_x * $scale; $output_size_height = $matrix_dim_with_padding_y * $scale; // Set colors/transparency $fore_color = $this->_matrixcode->getForeColor(); $back_color = $this->_matrixcode->getBackgroundColor(); $pdf = new Zend_Pdf(); $pdf->pages[] = $page = $pdf->newPage('A4'); // Add credits if (!empty($this->_footnote)) { $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); $page->setFont($font, 10)->setFillColor(Zend_Pdf_Color_Html::color('#000000'))->drawText($this->_footnote, 20, 20); } $page_width = $page->getWidth(); $page_height = $page->getHeight(); // Move center of coordination system (by default the lower left corner) $page->translate(floor($page_width - $output_size_width) / 2, ($page_height - $output_size_height) / 2); if (!empty($back_color)) { $back_color = new Zend_Pdf_Color_HTML('#' . $this->_decimalToHTMLColor($back_color)); $page->setFillColor($back_color); $page->drawRectangle(0, 0, $output_size_width, $output_size_height, Zend_Pdf_Page::SHAPE_DRAW_FILL); } $page->setFillColor(new Zend_Pdf_Color_HTML('#' . $this->_decimalToHTMLColor($fore_color))); // Convert the matrix into pixels $matrix = $this->_matrixcode->getMatrix(); for ($i = 0; $i < $matrix_dimension; $i++) { for ($j = 0; $j < $matrix_dimension; $j++) { if ($matrix[$i][$j]) { $x = ($i + $padding[3]) * $scale; $y = ($matrix_dimension - 1 - $j + $padding[2]) * $scale; $page->drawRectangle($x, $y, $x + $scale, $y + $scale, Zend_Pdf_Page::SHAPE_DRAW_FILL); } } } if ($this->_send_result) { $this->_sendOutput($pdf->render()); } else { return $pdf; } return; }
$page->saveGS(); $page->clipCircle(550, -10, 50); if ($stampImage != null) { $page->drawImage($stampImage, 500, -60, 600, 40); } $page->restoreGS(); $page->drawText('Modified by Zend Framework!', 150, 0)->restoreGS(); } // Add new page generated by Zend_Pdf object (page is attached to the specified the document) $pdf->pages[] = $page1 = $pdf->newPage('A4'); // Add new page generated by Zend_Pdf_Page object (page is not attached to the document) $pdf->pages[] = $page2 = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE); // Create new font $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); // Apply font and draw text $page1->setFont($font, 36)->setFillColor(Zend_Pdf_Color_Html::color('#9999cc'))->drawText('Helvetica 36 text string', 60, 500); // Use font object for another page $page2->setFont($font, 24)->drawText('Helvetica 24 text string', 60, 500); // Use another font $page2->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES), 32)->drawText('Times-Roman 32 text string', 60, 450); // Draw rectangle $page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8))->setLineColor(new Zend_Pdf_Color_GrayScale(0.2))->setLineDashingPattern(array(3, 2, 3, 4), 1.6)->drawRectangle(60, 400, 400, 350); // Draw circle $page2->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID)->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0))->drawCircle(85, 375, 25); // Draw sectors $page2->drawCircle(200, 375, 25, 2 * M_PI / 3, -M_PI / 6)->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0))->drawCircle(200, 375, 25, M_PI / 6, 2 * M_PI / 3)->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0))->drawCircle(200, 375, 25, -M_PI / 6, M_PI / 6); // Draw ellipse $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0))->drawEllipse(250, 400, 400, 350)->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0))->drawEllipse(250, 400, 400, 350, M_PI / 6, 2 * M_PI / 3)->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0))->drawEllipse(250, 400, 400, 350, -M_PI / 6, M_PI / 6); // Draw and fill polygon $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1)); $x = array();
/** * Generate a review portal pdf. * * @param integer $portalId * @return string The pdf name */ protected function _generatePdf($portalId) { $portal = new Object_ReviewPortal($portalId); if (!$portal->getId()) { return false; } // Get the screenshots of all the portal pages. $pages = Repo_ReviewPortalPage::getInstance()->getPortalPages($portalId); if (!$pages || $pages->count() == 0) { return false; } $pdf = new Zend_Pdf(); $pageNumber = 1; $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); $fontSize = 10; foreach ($pages as $_p) { $_images = array(); $_page = new Object_Page($_p->id); // Try get static screenshots if the setting is set. if ($_page->screenshot_type == Repo_Page::SCREENSHOT_TYPE_STATIC) { $_images = $_page->getStaticScreenshots(true); } // Get dynamic one. if (empty($_images)) { $_images[] = Manager_ScreenCapture_Page::getInstance()->getScreenshot($_p->id); } foreach ($_images as $_image) { $_pdfImage = Zend_Pdf_Image::imageWithPath($_image); $_pdfPage = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE); $_pdfPage->drawImage($_pdfImage, 20, 36, $_pdfPage->getWidth() - 20, $_pdfPage->getHeight() - 20); $_pdfPage->setFont($font, 16); $_pdfPage->setFillColor(Zend_Pdf_Color_Html::color('#333333'))->drawText($pageNumber, $_pdfPage->getWidth() / 2, 10); $pageNumber++; $pdf->pages[] = $_pdfPage; } } $pdfName = $portalId . '_' . time() . '.pdf'; $path = $this->_rootPath . DS . $pdfName; $pdf->save($path); return $pdfName; }
public function getPdf($data) { $this->_currentPage = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4); $style = new Zend_Pdf_Style(); $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES); $style->setFont($fontH, 12); $color = Zend_Pdf_Color_Html::color('black'); $style->setFillColor($color); $linkStyle = new Zend_Pdf_Style(); $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); $linkStyle->setFont($fontH, 10); $color = Zend_Pdf_Color_Html::color('blue'); $linkStyle->setFillColor($color); $linkStyle->setLineColor($color); $this->_initCoordinates(); $this->addImage(Mage::getDesign()->getSkinUrl('images/logo_email.gif', array('_area' => 'frontend')), 30); $this->addNewLine(4); $helloStyle = new Zend_Pdf_Style(); $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD); $helloStyle->setFont($fontH, 14); $color = Zend_Pdf_Color_Html::color('black'); $helloStyle->setFillColor($color); $this->addText('Hello, ' . $data->getData('email-to') . "!", $helloStyle); $this->addNewLine(3); $this->addText('You have received a ' . $data->getAmount() . ' Gift Card from ', $style); $fromStyle = new Zend_Pdf_Style(); $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD); $fromStyle->setFont($fontH, 10); $this->addText($data->getData('email-from'), $fromStyle); $this->addText("! ", $style); $store = Mage::getModel('core/store')->load($data->getStoreId()); $this->addText('This card may be redeemed on ' . $store->getFrontendName() . ' website. Happy shopping!', $style); $this->addNewLine(1, $style->getFontSize()); $this->addImage($data->getPicture(), 400, $this->getLineLimit()); $this->addNewLine(5); $subStyle = new Zend_Pdf_Style(); $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD); $subStyle->setFont($fontH, 13); $color = Zend_Pdf_Color_Html::color('gray'); $subStyle->setFillColor($color); $this->addText('to: ' . $data->getData('email-to'), $subStyle); $this->addNewLine(1, $subStyle->getFontSize()); $this->addText('from: ' . $data->getData('email-from'), $subStyle); $this->addNewLine(1, $subStyle->getFontSize()); $this->addText("message: " . $data->getData('email-message'), $subStyle); $this->addNewLine(1, $subStyle->getFontSize()); $this->addText('gift card value:' . $data->getAmount(), $subStyle); $this->addNewLine(1, $subStyle->getFontSize()); $this->addText('gift card claim code:' . $data->getCode(), $subStyle); $this->addNewLine(1, $subStyle->getFontSize()); $this->addNewLine(5); $subStyle = new Zend_Pdf_Style(); $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD); $subStyle->setFont($fontH, 9); $color = Zend_Pdf_Color_Html::color('black'); $subStyle->setFillColor($color); $this->addText('To redeem and use you gift card: ', $subStyle); $this->addNewLine(1, $subStyle->getFontSize()); $this->addText(' 1. Create an account and login into ' . $store->getUrl() . ".", $subStyle); $this->addNewLine(1, $subStyle->getFontSize()); $this->addText(' 2. Redeem the card in My Gift Cards page of My Account section.', $subStyle); $this->addNewLine(1, $subStyle->getFontSize()); $this->addText(' 3. Alternatively, you can redeem the card on My Cart page before proceeding to checkout.', $subStyle); $this->addNewLine(2, $subStyle->getFontSize()); $this->addText('If you have any questions please contact us at ' . Mage::getStoreConfig('trans_email/ident_support/email'), $subStyle); $phone = $data->getData('store-phone'); if (isset($phone)) { $this->addText(' or call us at ' . $phone . " Monday - Friday, 8am - 5pm PST.", $subStyle); } $this->_currentPdf = new Zend_Pdf(); $this->_currentPdf->pages[] = $this->_currentPage; $this->clearTempFiles(); return $this->_currentPdf->render(); }
/** * Drwas a rectangle to the current page. * * @param int $x1 X coordinate of the top left corner * @param int $y1 Y coordinate of the top left corner * @param int $x2 X coordinate of the bottom right corner * @param int $y2 Y coordinate of the bottom right corner * @param string $line_color Valid HTML color value for the border, see <Zend_Pdf_Color_Html> * @param string $fill_color Valid HTML color value to fill the rectangle, see <Zend_Pdf_Color_Html> * @return PdfDocument `$this` */ public function drawRectangle($x1, $y1, $x2, $y2, $line_color = 'black', $fill_color = '') { if (!$this->currentPage) { $this->currentPage = $this->createNewPage(); } if ($line_color && $fill_color) { $this->currentPage->setLineColor(Zend_Pdf_Color_Html::color($line_color)); $this->currentPage->setFillColor(Zend_Pdf_Color_Html::color($fill_color)); $this->currentPage->drawRectangle($x1, $y1, $x2, $y2, Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE); } elseif ($line_color && !$fill_color) { $this->currentPage->setLineColor(Zend_Pdf_Color_Html::color($line_color)); $this->currentPage->drawRectangle($x1, $y1, $x2, $y2, Zend_Pdf_Page::SHAPE_DRAW_STROKE); } elseif (!$line_color && $fill_color) { $this->currentPage->setFillColor(Zend_Pdf_Color_Html::color($fill_color)); $this->currentPage->drawRectangle($x1, $y1, $x2, $y2, Zend_Pdf_Page::SHAPE_DRAW_FILL); } return $this; }
public function downloadAction() { if ($this->_loadValidVoucher()) { $voucherCode = $this->getRequest()->getParam('code'); $text = Mage::helper('voucher'); $_product = Mage::registry('current_product'); $pdf = new Zend_Pdf(); $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER); $pageHeight = $page->getHeight(); $pageWidth = $page->getWidth(); //$page->rotate(($pageWidth/2), ($pageHeight/2), 1); $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); $logoImage = Zend_Pdf_Image::imageWithPath(Mage::getDesign()->getSkinBaseDir() . '/images/logo_small_en.jpg'); //$footerImage = Zend_Pdf_Image::imageWithPath(Mage::getDesign()->getSkinBaseDir() . '/images/voucher_footer_en.png'); //VD $productImage = Zend_Pdf_Image::imageWithPath(Mage::getBaseDir() . '/media/catalog/product' . $_product->getVoucherImage()); //$footerImageHeight = $footerImage->getPixelHeight(); //VD //$footerImageWidth = $footerImage->getPixelWidth(); //VD $logoImageHeight = 75; //VDEdit $logoImageWidth = 250; //VDEdit $tableWidth = 568; $startPoint = ($pageWidth - $tableWidth) / 2; $endPoint = $startPoint + $tableWidth; $botPoint = 10; $topPoint = $pageHeight - 30; $page->setLineWidth('0.3')->setLineDashingPattern(array(3, 3, 3, 3))->drawLine($startPoint, $topPoint, $startPoint, $botPoint)->drawLine($endPoint, $topPoint, $endPoint, $botPoint)->drawLine($startPoint, $topPoint, $endPoint, $topPoint)->drawLine($startPoint, $botPoint, $endPoint, $botPoint)->drawLine($startPoint, $pageHeight - $logoImageHeight - 235, $endPoint, $pageHeight - $logoImageHeight - 235)->drawLine($startPoint, $pageHeight - $logoImageHeight - 235 - 325, $endPoint, $pageHeight - $logoImageHeight - 235 - 325); $page->setFillColor(Zend_Pdf_Color_Html::color('#16599D'))->drawRectangle($startPoint + 2, $topPoint - $logoImageHeight - 2, $endPoint, $topPoint); $page->drawImage($logoImage, $startPoint, $topPoint - $logoImageHeight - 1, $startPoint + $logoImageWidth, $topPoint); //$page->drawImage($footerImage, $startPoint + 2, $botPoint, $startPoint + $footerImageWidth - 20, $botPoint + $footerImageHeight); $page->drawImage($productImage, $startPoint + 7, $topPoint - 55 - $productImage->getPixelHeight(), $startPoint + 7 + 246, $topPoint - 55 - $productImage->getPixelHeight() + 165); $page->setFillColor(Zend_Pdf_Color_Html::color('#FFFFFF'))->setLineDashingPattern(array(1, 0, 1, 0))->drawRectangle($endPoint - 205, $topPoint - 10, $endPoint - 15, $topPoint + 10)->setLineDashingPattern(array(0, 1000, 0, 1000))->setFillColor(Zend_Pdf_Color_Html::color('#EDF4FA'))->drawRectangle($startPoint + 0.3, $pageHeight - $logoImageHeight - 235, $endPoint, $pageHeight - $logoImageHeight - 235 - 325); $style = new Zend_Pdf_Style(); $style->setFont($font, 15); $page->setFont($font, 12)->setFillColor(Zend_Pdf_Color_Html::color('#000000'))->drawText($text->__('Voucher Code: ' . $voucherCode), $endPoint - 193, $topPoint - 4)->setFont($font, 15); $lines = explode("\n", $this->getWrappedText($text->__('Voucher for ') . $_product->getName(), $style, 270)); //var_dump($lines); foreach ($lines as $k => $line) { $page->drawText($line, $startPoint + $productImage->getPixelWidth() + 20, $topPoint - 70 - $k * 20); } // $pdf->pages[0] = $page; $pdf->save(Mage::getBaseDir() . '/media/vouchers/' . $voucherCode . '.pdf'); $this->getResponse()->clearHeaders()->setHeader('content-type:', 'Application/pdf')->setHeader('Content-Type', 'application/force-download')->setHeader('Content-Disposition', 'attachment; filename="' . $voucherCode . '.pdf"')->setBody($pdf->render()); } }
/** * Insert a claim details into a PDF. * * @param int $claimRefNo * * @return void */ public function populateAndOuputClaimStatusReport($claimRefNo, $agentSchemeNumber) { $claimDataSource = new Datasource_Insurance_KeyHouse_Claim(); $claimData = $claimDataSource->getClaim($claimRefNo, $agentSchemeNumber); $pdf = new Zend_Pdf_WrapText(); // create A4 page $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4); // Add HomeLet logo $xcoord = 15; $ycoord = 780; $image = Zend_Pdf_Image::imageWithPath(APPLICATION_PATH . '/../public/assets/common/images/logo-mid.png'); $page->drawImage($image, $xcoord, $ycoord, $xcoord + $image->getPixelWidth(), $ycoord + $image->getPixelHeight()); // define a style $claimHeaderFont = new Zend_Pdf_Style(); $claimHeaderFont->setFillColor(Zend_Pdf_Color_Html::color('#FF6F1C')); $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); $claimHeaderFont->setFont($font, 14); // define another style $claimContentTitleFont = new Zend_Pdf_Style(); $claimContentTitleFont->setFillColor(Zend_Pdf_Color_Html::color('#0C2F6B')); $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD); $claimContentTitleFont->setFont($font, 10); // define another style $claimContentFont = new Zend_Pdf_Style(); $claimContentFont->setFillColor(Zend_Pdf_Color_Html::color('#0C2F6B')); $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); $claimContentFont->setFont($font, 10); // write title text to page $page->setStyle($claimHeaderFont)->drawText('Claim Status Report', 250, 810); // write content text to page $page->setStyle($claimContentTitleFont)->drawText('Claim Number', 15, 700); $page->setStyle($claimContentFont)->drawText($claimData[0]['ClaimNo'], 200, 700); $page->setStyle($claimContentTitleFont)->drawText('Claim Handler', 15, 680); $page->setStyle($claimContentFont)->drawText($claimData[0]['ClaimsHandler'], 200, 680); $page->setStyle($claimContentTitleFont)->drawText('Reference Number', 15, 660); $page->setStyle($claimContentFont)->drawText($claimData[0]['ClaimNo'], 200, 660); $page->setStyle($claimContentTitleFont)->drawText('Start Date', 15, 640); $page->setStyle($claimContentFont)->drawText($claimData[0]['ClaimDate'], 200, 640); $page->setStyle($claimContentTitleFont)->drawText('Date', 35, 590); $page->setStyle($claimContentTitleFont)->drawText('Action', 235, 590); $page->setStyle($claimContentTitleFont)->drawText('Status', 435, 590); // wrap text to avoid overlapping $zendWrapText = new Zend_Pdf_WrapText(); $sectionHeight = 0; $y = 570; for ($i = 0; $i < count($claimData); $i++) { $page->setStyle($claimContentFont)->drawText($claimData[$i]['ClaimDate'], 35, $y); $sectionHeight = $zendWrapText->drawWrappedText($page, 235, $y, $claimData[$i]['Activity'], 150, $claimContentFont); //$page->setStyle($claimContentFont)->drawTextBlock($claimData[$i]['Activitiy'], 235, 570, 200, 200, Zend_Pdf_Page::ALIGN_LEFT); $page->setStyle($claimContentFont)->drawText($claimData[$i]['OpenOrClosed'], 435, $y); $y -= $sectionHeight; } // add page to document $pdf->pages[] = $page; $filename = "claimstatus_" . md5($claimRefNo); // send to browser as download return $pdf->render(); }