Exemplo n.º 1
0
 public function addNext($giftCard)
 {
     $template = $giftCard->getTemplate();
     if (!$template) {
         return false;
     }
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $draw = Mage::getModel('giftcard/giftcard_draw');
     $draw->setGiftCard($giftCard);
     $draw->setTemplate($template);
     $draw->drawGiftCard();
     if (!($imagePath = $draw->getImagePath())) {
         return false;
     }
     $image = Zend_Pdf_Image::imageWithPath($imagePath);
     $imgWidthPts = $image->getPixelWidth() * 72 / 96;
     $imgHeightPts = $image->getPixelHeight() * 72 / 96;
     $rate = $imgWidthPts / $page->getWidth();
     $imgWidthPts = $imgWidthPts / $rate;
     $imgHeightPts = $imgHeightPts / $rate;
     $pageHeight = $page->getHeight();
     $page->drawImage($image, 0, $pageHeight - $imgHeightPts, $imgWidthPts, $pageHeight);
     $this->addPage($page);
     unlink($imagePath);
     return true;
 }
Exemplo n.º 2
0
 public function getPdf()
 {
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $page->setFont($font, 12);
     $width = $page->getWidth();
     $i = 0;
     $this->insertLogo($page);
     $this->insertAddress($page);
     /*$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
       $page->drawRectangle(25, $this->y + 15, 190, $this->y - 35);
       $page->drawRectangle(190, $this->y + 15, 350, $this->y - 35);
       $page->drawRectangle(350, $this->y + 15, 570, $this->y - 35);*/
     $page->setFont($font, 16);
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.5));
     $page->drawRectangle(25, $this->y + 15, 573, $this->y - 57);
     $page->setFillColor(new Zend_Pdf_Color_Html('#ffffff'));
     $headerText = "Report: Net Sales & Tax";
     $page->drawText($headerText, 30, $this->y, 'UTF-8');
     $this->y -= 22;
     $page->drawText("From: " . $this->from, 30, $this->y, 'UTF-8');
     $this->y -= 22;
     $page->drawText("To: " . $this->to, 30, $this->y, 'UTF-8');
     $page->setFont($font, 14);
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Total Net Sale');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalSale(), true, false);
     $page->drawText($total, 505, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Net Sales Texas Only');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasSale(), true, false);
     $page->drawText($total, 505, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Net Shipping Costs for Texas only');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasShipping(), true, false);
     $page->drawText($total, 505, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Texas Net Sales Tax');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasTax(), true, false);
     $page->drawText($total, 505, $this->y, 'UTF-8');
     $pdf->pages[] = $page;
     return $pdf->render();
 }
Exemplo n.º 3
0
 protected function _printComments($order, Zend_Pdf_Page $page)
 {
     if (Mage::helper('core')->isModuleEnabled('Magemaven_OrderComment') && ($order->getCustomerComment() || $order->getCustomerNote())) {
         $comment = Mage::helper('ordercomment')->escapeHtml($order->getCustomerComment() ? $order->getCustomerComment() : $order->getCustomerNote());
         $this->y -= 15;
         $page->drawText(Mage::helper('ordercomment')->__('Order Comment'), 35, $this->y, 'UTF-8');
         $this->y -= 15;
         $leftToPrint = explode(' ', $comment);
         $availableWidth = $page->getWidth();
         while (!empty($leftToPrint)) {
             $currentLine = $leftToPrint;
             $leftToPrint = array();
             while ($this->widthForStringUsingFontSize(implode(' ', $currentLine), $page->getFont(), $page->getFontSize()) > $availableWidth) {
                 $leftToPrint[] = array_pop($currentLine);
             }
             $page->drawText(implode(' ', $currentLine), 35, $this->y, 'UTF-8');
         }
     }
     return $page;
 }
Exemplo n.º 4
0
 /**
  * Prepares the text so that it fits to the given page's width.
  *
  * @param  string                 $text     the text which should be prepared
  * @param  Zend_Pdf_Page          $page     the page on which the text will be rendered
  * @param  Zend_Pdf_Resource_Font $font     the font with which the text will be rendered
  * @param  int                    $fontSize the font size with which the text will be rendered
  * @param  int                    $width    [optional] the width for the given text, defaults to the page width
  *
  * @return array the given text in an array where each item represents a new line
  */
 public function _prepareText($text, $page, $font, $fontSize, $width = null)
 {
     if (empty($text)) {
         return array();
     }
     $lines = '';
     $currentLine = '';
     // calculate the page's width with respect to the margins
     if (empty($width)) {
         $width = $page->getWidth() - $this->margin['left'] - ($page->getWidth() - $this->margin['right']);
     }
     $textChunks = explode(' ', $text);
     foreach ($textChunks as $textChunk) {
         if ($this->widthForStringUsingFontSize($currentLine . ' ' . $textChunk, $font, $fontSize) < $width) {
             // do not add whitespace on first line
             if (!empty($currentLine)) {
                 $currentLine .= ' ';
             }
             $currentLine .= $textChunk;
         } else {
             // text is too broad, so add new line character
             $lines .= $currentLine . "\n";
             $currentLine = $textChunk;
         }
     }
     // append the last line
     $lines .= $currentLine;
     return explode("\n", $lines);
 }
Exemplo n.º 5
0
 /**
  *
  * @param Zend_Pdf_Page $page 
  * @return void Process drawImage on PDF page
  */
 protected function drawWaterMask(&$page)
 {
     if (Mage::getStoreConfig('advancedinvoiceprinting_options/general/enable') == 0) {
         return;
     }
     $pageWidth = $page->getWidth();
     $pageHeight = $page->getHeight();
     $image = $this->getImage();
     if (is_file($image)) {
         /* @var $image Zend_Pdf_Resource_Image */
         $image = Zend_Pdf_Image::imageWithPath($image);
         $imgWidth = $image->getPixelWidth();
         $imgHeight = $image->getPixelHeight();
         $percent = Mage::getStoreConfig('advancedinvoiceprinting_options/general/images_size');
         $imgWidth = $imgWidth * $percent / 100;
         $imgHeight = $imgHeight * $percent / 100;
         $x = ($pageWidth - $imgWidth) / 2;
         $y = ($pageHeight - $imgHeight) / 2;
         if (is_numeric(Mage::getStoreConfig('advancedinvoiceprinting_options/general/offset_x'))) {
             $x = $x + (int) Mage::getStoreConfig('advancedinvoiceprinting_options/general/offset_x');
         }
         if (is_numeric(Mage::getStoreConfig('advancedinvoiceprinting_options/general/offset_y'))) {
             $y = $y - (int) Mage::getStoreConfig('advancedinvoiceprinting_options/general/offset_y');
         }
         $page->drawImage($image, $x, $y, $x + $imgWidth, $y + $imgHeight);
     }
 }
Exemplo n.º 6
0
 /**
  * Insert logo to pdf page
  *
  * @param Zend_Pdf_Page $page
  * @param null $store
  */
 protected function insertLogo(&$page, $store = null)
 {
     $this->y = $this->y ? $this->y : 815;
     $image = Mage::getStoreConfig('sales/identity/logo', $store);
     if ($image) {
         $image = Mage::getBaseDir('media') . '/sales/store/logo/' . $image;
         if (is_file($image)) {
             $image = Zend_Pdf_Image::imageWithPath($image);
             $top = 830;
             //top border of the page
             $widthLimit = 270;
             //half of the page width
             $heightLimit = 270;
             //assuming the image is not a "skyscraper"
             $width = $image->getPixelWidth();
             $height = $image->getPixelHeight();
             //preserving aspect ratio (proportions)
             $ratio = $width / $height;
             if ($ratio > 1 && $width > $widthLimit) {
                 $width = $widthLimit;
                 $height = $width / $ratio;
             } elseif ($ratio < 1 && $height > $heightLimit) {
                 $height = $heightLimit;
                 $width = $height * $ratio;
             } elseif ($ratio == 1 && $height > $heightLimit) {
                 $height = $heightLimit;
                 $width = $widthLimit;
             }
             $width /= 2;
             $height /= 2;
             $border = 30;
             $y1 = $top - $height;
             $y2 = $top;
             $x1 = $page->getWidth() - $width - $border;
             $x2 = $page->getWidth() - $border;
             //coordinates after transformation are rounded by Zend
             $page->drawImage($image, $x1, $y1, $x2, $y2);
             $this->y = $y1 - 10;
         }
     }
 }
Exemplo n.º 7
0
 /**
  * Add the token to a pdf page
  *
  * @param \Zend_Pdf_Page $page
  * @param string $tokenId
  */
 protected function addTokenToPage(\Zend_Pdf_Page $page, $tokenId)
 {
     // Set $this->pageFont to false to prevent drawing of tokens on page.
     if ($this->pageFont) {
         $font = \Zend_Pdf_Font::fontWithName($this->pageFont);
         if ($this->pageXfromLeft) {
             $x = $this->pageX;
         } else {
             $x = $page->getWidth() - $this->pageX;
         }
         if ($this->pageYfromTop) {
             $y = $page->getHeight() - $this->pageY;
         } else {
             $y = $this->pageY;
         }
         $page->setFont($font, $this->pageFontSize);
         $page->drawText(strtoupper($tokenId), $x, $y, 'UTF-8');
     }
 }
Exemplo n.º 8
0
 public function getPdf()
 {
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $page->setFont($font, 12);
     $width = $page->getWidth();
     $i = 0;
     $this->insertLogo($page);
     $this->insertAddress($page);
     /*$page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
       $page->drawRectangle(25, $this->y + 15, 190, $this->y - 35);
       $page->drawRectangle(190, $this->y + 15, 350, $this->y - 35);
       $page->drawRectangle(350, $this->y + 15, 570, $this->y - 35);*/
     $page->setFont($font, 16);
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.5));
     $page->drawRectangle(25, $this->y + 15, 573, $this->y - 57);
     $page->setFillColor(new Zend_Pdf_Color_Html('#ffffff'));
     $headerText = "Report: Net Sales & Tax";
     $page->drawText($headerText, 30, $this->y, 'UTF-8');
     $this->y -= 22;
     $page->drawText("From: " . $this->from, 30, $this->y, 'UTF-8');
     $this->y -= 22;
     $page->drawText("To: " . $this->to, 30, $this->y, 'UTF-8');
     $fontSize = 14;
     $rightMg = 27;
     $page->setFont($font, $fontSize);
     $timeZone = Mage::getStoreConfig('general/locale/timezone');
     //echo $timeZone;
     //date_default_timezone_set('UTC');
     date_default_timezone_set($timeZone);
     $diff = date('Z');
     $diff = $diff * -1;
     //go opposite
     $from = strtotime($this->from . ' ' . $diff . ' seconds');
     $to = strtotime($this->to . ' ' . $diff . ' seconds');
     $this->from = date('Y-m-d H:i:s', $from);
     $this->to = date('Y-m-d H:i:s', $to);
     if (empty($from) || empty($to)) {
         throw new Exception('\'To date\' and \'From date\' are required.');
         return;
     }
     if ($from > $to) {
         throw new Exception('\'To date\' cannot be smaller than \'From date\'');
         return;
     }
     /*if($from==$to)
       {
       	$this->to=date('Y-m-d H:i:s', strtotime($this->to. ' + 1 days'));
       }*/
     $this->to = date('Y-m-d H:i:s', strtotime($this->to . ' + 1 days'));
     //$this->from=date('Y-m-d H:i:s', strtotime($this->from));
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Total Sales');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalSale(), true, false);
     $txtWidth = $this->getTextWidth($total, $font, $fontSize) + $rightMg;
     $page->drawText($total, $width - $txtWidth - $fontSize, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Total Texas Sales');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasSale(), true, false);
     $txtWidth = $this->getTextWidth($total, $font, $fontSize) + $rightMg;
     $page->drawText($total, $width - $txtWidth - $fontSize, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Shipping Costs Texas Only');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasShipping(), true, false);
     $txtWidth = $this->getTextWidth($total, $font, $fontSize) + $rightMg;
     $page->drawText($total, $width - $txtWidth - $fontSize, $this->y, 'UTF-8');
     $this->y -= 50;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $totalText = Mage::helper('sales')->__('Texas Sales Tax');
     $page->drawText($totalText, 25, $this->y, 'UTF-8');
     $total = Mage::helper('core')->currency($this->getTotalTexasTax(), true, false);
     $txtWidth = $this->getTextWidth($total, $font, $fontSize) + $rightMg;
     $page->drawText($total, $width - $txtWidth - $fontSize, $this->y, 'UTF-8');
     $pdf->pages[] = $page;
     return $pdf->render();
 }
Exemplo n.º 9
0
 /**
  * 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;
 }
Exemplo n.º 10
0
 /**
  * Get Page Width
  *
  * @param bool $intContentArea
  * @return int
  */
 public function getWidth($intContentArea = false)
 {
     $width = parent::getWidth();
     if ($intContentArea) {
         $width -= $this->_margin[Core_Pdf::LEFT];
         $width -= $this->_margin[Core_Pdf::RIGHT];
     }
     return $width;
 }
 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());
     }
 }
Exemplo n.º 12
0
 private function background(Zend_Pdf_Page $page, $idEncontro = 0)
 {
     if ($idEncontro > 0) {
         $file = APPLICATION_PATH . "/../public/img/certificados/{$idEncontro}/modelo.jpg";
         if (!file_exists($file)) {
             $file = APPLICATION_PATH . "/../public/img/certificados/default/modelo.jpg";
         }
         if (!file_exists($file)) {
             throw new Exception("É necessário que o arquivo {$file} exista.");
         }
         $height = $page->getHeight();
         $width = $page->getWidth();
         $image = Zend_Pdf_Image::imageWithPath($file);
         $page->drawImage($image, 0, 0, $width, $height);
     }
 }
Exemplo n.º 13
0
 public function getPdfFile()
 {
     $this->_isExport = true;
     $this->_prepareGrid();
     $this->getCollection()->getSelect()->limit();
     $this->getCollection()->setPageSize(0);
     $this->getCollection()->load();
     $this->_afterLoadCollection();
     $pdf = new Zend_Pdf();
     $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $page->setFont($font, 12);
     $width = $page->getWidth();
     $i = 20;
     $col = array();
     $header_arr = array();
     foreach ($this->_columns as $column) {
         if ($column->getData('renderer') && $column->getData('renderer') != "") {
             $renderer = $column->getData('renderer');
         } else {
             $renderer = false;
         }
         $col[$column->getIndex()] = array('width' => round($column->getWidth() / 1.2), 'render' => $renderer);
         if (!$column->getIsSystem()) {
             $header = $column->getExportHeader();
             $header_arr[] = array('header' => $header, 'width' => "{$i}");
             //$page->drawText($header, $i, $page->getHeight()-20);
             $i += round($column->getWidth() / 1.2);
         }
     }
     //Mage::log($col);
     $height = $page->getHeight() - 30;
     $j = 0;
     $totl = 0;
     foreach ($this->getCollection() as $coll) {
         $i = 20;
         $data = $coll->getData();
         $sorted = $this->sortArrayByArray($data, $col);
         if ($totl % 20 == 0) {
             $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
             $page->setFont($font, 12);
             $totl = 0;
             $height = $page->getHeight() - 30;
             $width = $page->getWidth();
             $pdf->pages[] = $page;
             foreach ($header_arr as $header) {
                 $page->drawText($header['header'], $header['width'], $height);
             }
         }
         $height -= 20;
         $totl++;
         foreach ($sorted as $key => $value) {
             if ($col[$key]['render'] != "") {
                 $value = $this->getLayout()->createBlock($col[$key]['render'])->render($coll);
             }
             $page->drawText($value, $i, $height);
             $i += $col[$key]['width'];
         }
         $j++;
         //if($j == 50) break;
     }
     //$pdf->pages[] = $page;
     return $pdf->render();
 }
Exemplo n.º 14
0
 /**
  * Get width of page ( without margins )
  *
  * @return int Page width
  * @api
  */
 public function getWidth()
 {
     return parent::getWidth() - $this->MARGIN['left'] - $this->MARGIN['right'];
 }