当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Pdf_Style::setFont方法代码示例

本文整理汇总了PHP中Zend_Pdf_Style::setFont方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf_Style::setFont方法的具体用法?PHP Zend_Pdf_Style::setFont怎么用?PHP Zend_Pdf_Style::setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Pdf_Style的用法示例。


在下文中一共展示了Zend_Pdf_Style::setFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 public function process()
 {
     $configuracao = Doctrine::getTable('Configuracao')->find(1);
     $this->document->pages[] = $page = $this->document->newPage(\Zend_Pdf_Page::SIZE_A4);
     //monta o cabecalho
     $color = array();
     $color["black"] = new Zend_Pdf_Color_Html("#000000");
     $fontTitle = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
     $size = 12;
     $styleTitle = new Zend_Pdf_Style();
     $styleTitle->setFont($fontTitle, $size);
     $styleTitle->setFillColor($color["black"]);
     $page->setStyle($styleTitle);
     $page->drawText($configuracao->instituicao, Documento::DOCUMENT_LEFT, Documento::DOCUMENT_TOP, 'UTF-8');
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $style = new Zend_Pdf_Style();
     $style->setFont($font, $size);
     $style->setFillColor($color["black"]);
     $page->setStyle($style);
     $text = wordwrap($this->text, 95, "\n", false);
     $token = strtok($text, "\n");
     $y = 665;
     while ($token != false) {
         if ($y < 100) {
             $this->document->pages[] = $page = $this->document->newPage(Zend_Pdf_Page::SIZE_A4);
             $page->setStyle($style);
             $y = 665;
         } else {
             $y -= 15;
         }
         $page->drawText($token, 60, $y, 'UTF-8');
         $token = strtok("\n");
     }
 }
开发者ID:kidh0,项目名称:TCControl,代码行数:34,代码来源:AlunosMatriculadosDoc.class.php

示例2: setStyle

 public function setStyle()
 {
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     $style->setFillColor(new Zend_Pdf_Color_Html('#333333'));
     $style->setLineColor(new Zend_Pdf_Color_Html('#990033'));
     $style->setLineWidth(1);
     $this->_page->setStyle($style);
 }
开发者ID:nhochong,项目名称:qlkh-sgu,代码行数:9,代码来源:Page.php

示例3: getPdf

 public function getPdf($bidon = array())
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('invoice');
     //on cree le pdf que si il n'est pas déja défini( ca permet de mettre plrs documents dans le mm pdf (genre une facture, un BL ....)
     if ($this->pdf == null) {
         $this->pdf = new Zend_Pdf();
     }
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10);
     //cree la nouvelle page
     $titre = mage::helper('purchase')->__('Picking List');
     $settings = array();
     $settings['title'] = $titre;
     $settings['store_id'] = 0;
     $page = $this->NewPage($settings);
     //affiche l'entete du tableau
     $this->drawTableHeader($page);
     $this->y -= 10;
     //Affiche le récap des produits
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.2));
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     //charge la collection des produits
     $collection = Mage::getModel('Orderpreparation/ordertoprepare')->GetProductsSummary();
     foreach ($collection as $product) {
         //dessine
         $page->drawText($product->getqty_to_prepare(), 15, $this->y, 'UTF-8');
         $page->drawText($product->getAttributeText('manufacturer'), 70, $this->y, 'UTF-8');
         $page->drawText($product->getSku(), 180, $this->y, 'UTF-8');
         $page->drawText($product->getName(), 310, $this->y, 'UTF-8');
         //rajoute une ligne de séparation
         $page->setLineWidth(0.5);
         $page->drawLine(10, $this->y - 4, $this->_BLOC_ENTETE_LARGEUR, $this->y - 4);
         $this->y -= $this->_ITEM_HEIGHT;
         //si on a plus la place de rajouter le footer, on change de page
         if ($this->y < $this->_BLOC_FOOTER_HAUTEUR + 40) {
             $this->drawFooter($page);
             $page = $this->NewPage($settings);
             $this->drawTableHeader($page);
         }
     }
     //dessine le pied de page
     $this->drawFooter($page);
     //rajoute la pagination
     $this->AddPagination($this->pdf);
     $this->_afterGetPdf();
     return $this->pdf;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:48,代码来源:SelectedOrdersProductsSummaryPdf.php

示例4: getPdf

 public function getPdf($orders = array())
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('invoice');
     //on cree le pdf que si il n'est pas déja défini( ca permet de mettre plrs documents dans le mm pdf (genre une facture, un BL ....)
     $this->pdf = new Zend_Pdf();
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10);
     //cree la nouvelle page
     $titre = mage::helper('purchase')->__('Order Comments');
     $settings = array();
     $settings['title'] = $titre;
     $settings['store_id'] = 0;
     $page = $this->NewPage($settings);
     $this->y -= $this->_ITEM_HEIGHT * 2;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.2));
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     //Rajoute les commandes avec commentaires
     foreach ($orders as $order) {
         $comments = mage::helper('Organizer')->getEntityCommentsSummary('order', $order->getorder_id(), false);
         if ($comments != '') {
             $realOrder = mage::getModel('sales/order')->load($order->getorder_id());
             $page->drawText(mage::helper('purchase')->__('Order # ') . $realOrder->getIncrementId(), 15, $this->y, 'UTF-8');
             $comments = $this->WrapTextToWidth($page, $comments, 450);
             $offset = $this->DrawMultilineText($page, $comments, 150, $this->y, 10, 0.2, 11);
             $this->y -= 8 + $offset;
             $page->drawLine(10, $this->y, $this->_BLOC_ENTETE_LARGEUR, $this->y);
             $this->y -= 15;
         }
     }
     //dessine le pied de page
     $this->drawFooter($page);
     //rajoute la pagination
     $this->AddPagination($this->pdf);
     $this->_afterGetPdf();
     return $this->pdf;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:37,代码来源:SelectedOrdersComments.php

示例5: foreach

    }
} else {
    foreach ($pdf->pages as $num => $obj) {
        $obj->setStyle($bulletin_style);
        $obj->drawRectangle(30, 32, 150, 20);
        $obj->setFillColor($black);
        $obj->drawText($stamp, 32, 24);
        // stamp
        $pdf->pages[$num] = $obj;
        // save
    }
}
// 5a. note on the time exception
if ($display_name == "A-Note-on-the-Time") {
    $style = new Zend_Pdf_Style();
    $style->setFont(Zend_Pdf_Font::fontWithPath($note_font_path), $note_font_size);
    $style->setFillColor($white);
    $boxes = array();
    $stampText = date('Y M d g:i A', $now);
    $date1 = "2011-02-18 3:34";
    // the time of writing
    $date2 = date('Y-M-d g:i', $now);
    $daylightSaving = date('I');
    $diff = abs(strtotime($date2) - strtotime($date1));
    $days = floor($diff / (60 * 60 * 24));
    $hours = floor(($diff - $days * 60 * 60 * 24) / (60 * 60));
    $minutes = floor(($diff - $days * 60 * 60 * 24 - $hours * 60 * 60) / 60);
    $hours = $hours + $daylightSaving;
    $stampTextD = $days . " days, " . $hours . " hours, " . $minutes . " minutes.";
    // 2d array -- page, x, y, w, h, text
    $boxes = array(array(p => 2, x => 89, y => 602, w => 114, h => 15, t => $stampText), array(p => 4, x => 174, y => 482, w => 114, h => 15, t => $stampText), array(p => 5, x => 169, y => 617, w => 114, h => 15, t => $stampText), array(p => 6, x => 51, y => 362, w => 114, h => 15, t => $stampText), array(p => 6, x => 120, y => 77, w => 152, h => 15, t => $stampTextD));
开发者ID:O-R-G,项目名称:servinglibrary.org,代码行数:31,代码来源:download.php

示例6: stamp

 /**
  *  method to stamp each pdf page (add a banner with timestamp user real name and  confidentiality level)
  *  @param  void
  *  @return void
  */
 public function stamp($values)
 {
     // Prepare stamp
     if ($values != null) {
         $first = true;
         foreach ($values as $value) {
             if ($first) {
                 $sep = '';
                 $first = false;
             } else {
                 $sep = ', ';
             }
             $valueTxt = $sep . $value->getName();
         }
     } else {
         $valueTxt = '';
     }
     $text = "Downloaded on " . date("d M Y H:i", $_SERVER['REQUEST_TIME']) . " by " . $this->user->getRealName() . " " . $valueTxt;
     $stamp = $text . " // " . $text;
     // Text and box style
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10);
     $style->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
     $style->setLineColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
     //get pdf watermarking level based on number of pages in pdf document.
     $watermarkingLevel = $this->getWatermarkingLevelFromPdfSize();
     // Stamp with adequate watermarking level
     switch ($watermarkingLevel) {
         case self::WATERMARK_EVERYPAGE:
             // Apply it on all pages
             foreach ($this->pdf->pages as $page) {
                 $this->stampOnePage($page, $style, $stamp);
             }
             break;
         case self::WATERMARK_EVERY_TWO_PAGES:
             $count = 0;
             foreach ($this->pdf->pages as $page) {
                 if ($count % 2 == 0) {
                     $this->stampOnePage($page, $style, $stamp);
                 }
                 $count++;
             }
             break;
         case self::WATERMARK_THIRTY_PERCENT_OF_PAGES:
             $pagesToWatermark = $this->getPagesToWatermark(0.3, count($this->pdf->pages));
             foreach ($pagesToWatermark as $pageNo) {
                 $this->stampOnePage($this->pdf->pages[$pageNo], $style, $stamp);
             }
             break;
         case self::WATERMARK_TEN_PERCENT_OF_PAGES:
         default:
             $pagesToWatermark = $this->getPagesToWatermark(0.1, count($this->pdf->pages));
             foreach ($pagesToWatermark as $pageNo) {
                 $this->stampOnePage($this->pdf->pages[$pageNo], $style, $stamp);
             }
             break;
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:63,代码来源:DocmanWatermark_Stamper.class.php

示例7: byProduct

 public function byProduct($product, $for_catalog = false)
 {
     $category = $product->findManyToManyRowset("Model_DbTable_Categories", "Model_DbTable_CategoryXref")->current();
     if ($category) {
         $this->category = $category->getBcnName();
     } else {
         $this->category = "Неизвестно";
     }
     $productParams = $product->getParams();
     if (!$for_catalog) {
         $this->margins = array('top' => 35, 'right' => 20, 'bottom' => 35, 'left' => 20);
     }
     if (is_null($this->book)) {
         $page = $this->createBook(1, $for_catalog);
     } else {
         $page = $this->lastPage();
     }
     $offset = $for_catalog == false ? 0 : $page->getHeight() - $page->getCurrentPosition() - 1;
     if (!$for_catalog) {
         $page->setMargins(35, 20, 35, 20);
     }
     $noteStyle = new Zend_Pdf_Style();
     $noteStyle->setFont(Model_Static_Fonts::get("Arial Narrow"), $this->format == 'A4' ? 6.5 : 4.5);
     $noteStyle->setLineWidth($page->getWidth() - 20);
     $style = new Zend_Pdf_Style();
     $style->setFont(Model_Static_Fonts::get("Arial Narrow"), $this->format == 'A4' ? 8.0 : 6.5);
     $style->setLineWidth($page->getWidth());
     $paramsLinesCount = 0;
     foreach ($productParams as $param) {
         $paramsLinesCount += count(explode("\n", $param->value));
     }
     $paramsLinesCount++;
     $subproductsModel = new Model_DbTable_Subproducts();
     $select = $subproductsModel->select()->order('order ASC');
     $subProducts = $product->findDependentRowset("Model_DbTable_Subproducts", 'SubproductsRel', $select);
     // расчет высоты всего продукта, проверка влезает ли он на страницу, если не влезает смотрим сколько именно не влезает и есть ли субпродукты,
     // которые мы може отрисовать на этой странице и перенести отстаток на другую страницу
     $productHeightWithoutTable = 10 + max(array(80, $this->format == 'A4' ? $paramsLinesCount * 12 : $paramsLinesCount * 8)) + ($product->description ? $page->getTextBlockHeight(trim($product->description), $style, 3) : 0);
     $productHeight = 20 + max(array(80, $this->format == 'A4' ? $paramsLinesCount * 12 : $paramsLinesCount * 8)) + ($product->description ? $page->getTextBlockHeight(trim($product->description), $style, 3) : 0) + (count($subProducts) <= 30 ? $this->format == 'A4' ? count($subProducts) * 12 + 10 : count($subProducts) * 8 + 12 + 15 : 0) + ($product->note ? $page->getTextBlockHeight($product->note, $noteStyle) + 10 : 0);
     // note*/
     if ($offset) {
         if ($page->getHeight() - $offset - 10 < (count($subProducts) <= 30 ? $productHeight : intval($productHeight) + 40)) {
             if ($page->getPageNumber() > 1) {
                 $page->drawCategory(isset($this->old_category) ? $this->old_category : $this->category);
                 $this->old_category = NULL;
                 $page = $this->addPage();
                 $offset = 0;
             }
         } else {
             if ($page->getCurrentPosition() < 700 && $for_catalog) {
                 $offset -= 5;
             }
             $page->init($offset);
             $this->old_category = $this->category;
         }
     } else {
         $this->old_category = $this->category;
     }
     $this->product_page = $page->getPageNumber();
     // DEBUG auto-height calculate
     if (isset($_REQUEST['DEBUG'])) {
         $page->drawHorizontalLine(-20, 575, $page->getHeight() - $offset, 1, new Zend_Pdf_Color_Html('green'));
         $page->drawHorizontalLine(-20, 575, $page->getHeight() - $offset - $productHeight, 2, new Zend_Pdf_Color_Html('red'));
         $page->drawTextBlock(count($subProducts), -20, $page->getHeight() - $offset - $productHeight);
     }
     // --- block / information
     $page->setFont(Model_Static_Fonts::get("Franklin Gothic Demi Cond"), 14);
     $page->drawTextBlock($product->sku, 5, $page->getHeight() - $offset);
     $page->setFont(Model_Static_Fonts::get("Franklin Gothic Demi Cond"), 10);
     $page->drawTextBlock($product->name, 5, $page->getHeight() - 10 - $offset);
     // --- block / images
     $images = array($product->image);
     if ($product->a_images) {
         $images[] = $product->a_images[0];
     }
     $x = 0;
     if ($page->getPageNumber() % 2 == 0) {
         // если картинки справа (иконки слева)
         $images = array_reverse($images);
         // здесь нужно посчитать правильные ширины отступов начала изображений
         $x = $page->getWidth() - 5;
         foreach ($images as $image) {
             $sizes = $page->picSize($this->getProductImageFullpath($image), $this::IMAGE_SIZE, $this::IMAGE_SIZE, 2);
             //$x = $x - $this::IMAGE_SIZE * $sizes[0];
             $x = $x - $this::IMAGE_SIZE;
             //echo $image." ";
         }
         $x = $x - 5 * (count($images) - 1);
     } else {
         // картинки слева - просто задаем базовый отступ по x
         $x += 5;
     }
     //echo $x." ";
     $count = 0;
     // count of images (x75)
     //в зависимости от задачи, выбираем папку с картинками, за это отвечает параметр $print
     foreach ($images as $image) {
         if ($this->print) {
             //$c = $page -> drawPic(APPLICATION_ROOT . '/files/images/product_tiff/' . substr($image, 0, strripos($image, ".")).'.tif', $x, $page -> getHeight() - 20 - $offset, $this::IMAGE_SIZE, $this::IMAGE_SIZE, isset($images[1]) ? 1 : 2,1);
             $c = $page->drawPic($this->getProductImageFullpath($image), $x, $page->getHeight() - 20 - $offset, $this::IMAGE_SIZE, $this::IMAGE_SIZE, 2, 1);
//.........这里部分代码省略.........
开发者ID:Alpha-Hydro,项目名称:alpha-hydro-antares,代码行数:101,代码来源:PdfBook.php

示例8: populateAndOuputClaimStatusReport

 /**
  * 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();
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:65,代码来源:Claim.php

示例9: getPdf

 public function getPdf($order = array())
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('invoice');
     $this->pdf = new Zend_Pdf();
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10);
     //cree la nouvelle page
     $titre = mage::helper('purchase')->__('Order #') . $order->getincrement_id() . ' ' . mage::helper('purchase')->__('Comments');
     $settings = array();
     $settings['title'] = $titre;
     $settings['store_id'] = 0;
     $page = $this->NewPage($settings);
     //cartouche
     $txt_date = "Date :  " . mage::helper('core')->formatDate($order->getCreatedAt(), 'long');
     $txt_order = mage::helper('purchase')->__('Order #') . $order->getId();
     //$adresse_fournisseur = Mage::getStoreConfig('sales/identity/address');
     $customer = mage::getmodel('customer/customer')->load($order->getCustomerId());
     $adresse_client = mage::helper('purchase')->__('Shipping Address') . ":\n" . $this->FormatAddress($order->getShippingAddress(), '', false, $customer->gettaxvat());
     $adresse_fournisseur = mage::helper('purchase')->__('Billing Address') . ":\n" . $this->FormatAddress($order->getBillingAddress(), '', false, $customer->gettaxvat());
     $this->AddAddressesBlock($page, $adresse_fournisseur, $adresse_client, $txt_date, $txt_order);
     //Rajoute le carrier et la date d'expe prévue & les commentaires
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     $this->y -= 15;
     $page->drawText(mage::helper('purchase')->__('Shipping') . ' : ' . $order->getShippingDescription(), 15, $this->y, 'UTF-8');
     $this->y -= 15;
     $comments = $this->WrapTextToWidth($page, $order->getmdn_comments(), 550);
     $offset = $this->DrawMultilineText($page, $comments, 15, $this->y, 10, 0.2, 11);
     $this->y -= 10 + $offset;
     $page->drawLine(10, $this->y, $this->_BLOC_ENTETE_LARGEUR, $this->y);
     //affiche l'entete du tableau
     $this->drawTableHeader($page);
     $this->y -= 10;
     //Affiche le récap des produits
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.2));
     $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     foreach ($order->getAllItems() as $item) {
         //recupere le produit
         $product = mage::getModel('catalog/product')->load($item->getproduct_id());
         //dessine
         $page->drawText((int) $item->getqty_ordered(), 15, $this->y, 'UTF-8');
         $page->drawText($product->getSku(), 70, $this->y, 'UTF-8');
         $page->drawText($product->getName(), 200, $this->y, 'UTF-8');
         $page->drawText($item->getreserved_qty(), 560, $this->y, 'UTF-8');
         //rajoute les commentaires
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_ITALIC), 8);
         $this->y -= $this->_ITEM_HEIGHT;
         $caption = $this->WrapTextToWidth($page, $item->getcomments(), 300);
         $offset = $this->DrawMultilineText($page, $caption, 200, $this->y, 10, 0.2, 11);
         $this->y -= $offset;
         //rajoute une ligne de séparation
         $page->setLineWidth(0.5);
         $page->drawLine(10, $this->y - 4, $this->_BLOC_ENTETE_LARGEUR, $this->y - 4);
         $this->y -= $this->_ITEM_HEIGHT;
         //si on a plus la place de rajouter le footer, on change de page
         if ($this->y < $this->_BLOC_FOOTER_HAUTEUR + 40) {
             $this->drawFooter($page);
             $page = $this->NewPage($settings);
             $this->drawTableHeader($page);
         }
     }
     //dessine le pied de page
     $this->drawFooter($page);
     //rajoute la pagination
     $this->AddPagination($this->pdf);
     $this->_afterGetPdf();
     return $this->pdf;
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:68,代码来源:OrderPreparationCommentsPdf.php

示例10:

}
if (file_exists($argv[1])) {
    $pdf = Zend_Pdf::load($argv[1]);
} else {
    $pdf = new Zend_Pdf();
}
//------------------------------------------------------------------------------------
// Reverse page order
$pdf->pages = array_reverse($pdf->pages);
// Create new Style
$style = new Zend_Pdf_Style();
$style->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0.9));
$style->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
$style->setLineWidth(3);
$style->setLineDashingPattern(array(3, 2, 3, 4), 1.6);
$style->setFont(new Zend_Pdf_Font_Standard(Zend_Pdf_Const::FONT_HELVETICA_BOLD), 32);
// Create new image object
$stampImage = new Zend_Pdf_Image_JPEG(dirname(__FILE__) . '/stamp.jpg');
// Mark page as modified
foreach ($pdf->pages as $page) {
    $page->saveGS();
    $page->setStyle($style);
    $page->rotate(0, 0, M_PI_2 / 3);
    $page->saveGS();
    $page->clipCircle(550, -10, 50);
    $page->drawImage($stampImage, 500, -60, 600, 40);
    $page->restoreGS();
    $page->drawText('Modified by Zend Framework!', 150, 0);
    $page->restoreGS();
}
// Add new page generated by Zend_Pdf object (page is attached to the specified the document)
开发者ID:jorgenils,项目名称:zend-framework,代码行数:31,代码来源:demo.php

示例11: getPdf

 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();
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:74,代码来源:Pdf.php

示例12: foreach

 $image = Zend_Pdf_Image::imageWithPath('./public/image/logo1.png');
 // write image to page
 $page1->drawImage($image, 240, 668, 360, 790);
 $diaChi = "Dia Chi: 268 Lý Thường Kiệt, Phường 9, Quận 10, TP. Hồ Chí Minh";
 $sdt = "SDT: 08 3568256";
 $page1->setStyle($style)->drawText($diaChi, 50, 650, $charEncoding = 'UTF-8');
 $page1->setStyle($style)->drawText($sdt, 50, 630, $charEncoding = 'UTF-8');
 $title = "THONG TIN DON XUAT";
 // Create new Style
 $styleTitle = new Zend_Pdf_Style();
 $styleTitle->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
 $styleTitle->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
 $styleTitle->setLineWidth(3);
 $styleTitle->setLineDashingPattern(array(3, 2, 3, 4), 1.6);
 $fontTitle = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
 $styleTitle->setFont($fontTitle, 30);
 $page1->setStyle($styleTitle)->drawText($title, 130, 600, $charEncoding = 'UTF-8');
 // add footer text
 $page1->drawLine(80, 25, $page2->getWidth() - 10, 25);
 $page1->drawImage($image, 20, 10, $image->getPixelWidth(), $image->getPixelHeight());
 $page1->setStyle($style)->drawText('Copyright @HCMUT. All rights reserved.', 200, 10);
 $page1->drawLine(40, 580, $page2->getWidth() - 10, 580);
 // 25 --> 580
 // Thông tin khach hang, Get thông tin theo mã khách hàng. Đơn xuất->Mã Đơn Hàng-> Mã Khách hàng
 $postMaKH = 1234;
 // Dữ liệu giả.
 $modelKhachhang = new Model_Khachhang();
 $thongtinkh = $modelKhachhang->getByMakh($postMaKH);
 foreach ($thongtinkh as $data) {
     $tenkh = $data['TenKhachHang'];
     $diachikh = $data['DiaChi'];
开发者ID:LongNguyen-51101909,项目名称:Zend1Example,代码行数:31,代码来源:data.php

示例13: downloadAction

 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());
     }
 }
开发者ID:liemnv,项目名称:Groupon-Clone-On-Magento,代码行数:46,代码来源:ViewController.php

示例14: getPdf

 public function getPdf($orders = array())
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('invoice');
     if ($this->pdf == null) {
         $this->pdf = new Zend_Pdf();
     } else {
         $this->firstPageIndex = count($this->pdf->pages);
     }
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10);
     foreach ($orders as $order) {
         //cree la nouvelle page
         $titre = mage::helper('purchase')->__('Purchase Order');
         $settings = array();
         $settings['title'] = $titre;
         $settings['store_id'] = 0;
         $page = $this->NewPage($settings);
         //cartouche
         //$txt_date = "Date :  ".mage::helper('core')->formatDate($order->getCreatedAt(), 'long');
         $txt_date = "Date :  " . date('d/m/Y', strtotime($order->getpo_date()));
         $txt_order = "PO# : " . $order->getpo_order_id();
         $adresse_fournisseur = $order->getSupplier()->getAddressAsText();
         if ($order->getShipTo() != '') {
             $adresse_client = $order->getShipTo();
         } else {
             $adresse_client = Mage::getStoreConfig('sales/identity/address');
         }
         $this->AddAddressesBlock($page, $adresse_fournisseur, $adresse_client, $txt_date, $txt_order);
         //affiche l'entete du tableau
         $this->drawTableHeader($page);
         $this->y -= 10;
         //Affiche les lignes produit
         foreach ($order->getProducts() as $item) {
             $productId = Mage::getModel('catalog/product')->getIdBySku($item->getSku());
             $product = Mage::getModel('catalog/product')->load($productId);
             //Pour les produits "standards"
             $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.2));
             $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
             //this is our real SKU
             $caption = $this->WrapTextToWidth($page, $item->getSku(), 55);
             $offset = $this->DrawMultilineText($page, $caption, 15, $this->y, 10, 0.2, 11);
             //display SKU or picture
             if ($this->_showPictures == false) {
                 $caption = $this->WrapTextToWidth($page, $item->getpop_supplier_ref(), 80);
                 $offset = $this->DrawMultilineText($page, $caption, 80, $this->y, 10, 0.2, 11);
             } else {
                 $product = mage::getModel('catalog/product')->load($item->getpop_product_id());
                 if ($product->getId()) {
                     $productImagePath = Mage::getBaseDir() . '/media/catalog/product' . $product->getsmall_image();
                     if (is_file($productImagePath)) {
                         try {
                             $image = Zend_Pdf_Image::imageWithPath($productImagePath);
                             $page->drawImage($image, 10, $this->y - $this->_pictureSize + 20, 5 + $this->_pictureSize, $this->y + 10);
                         } catch (Exception $ex) {
                         }
                     }
                 }
             }
             $caption = $this->WrapTextToWidth($page, $item->getpop_product_name(), 135);
             $offset = $this->DrawMultilineText($page, $caption, 160, $this->y, 10, 0.2, 11);
             //if ($order->getpo_status() != MDN_Purchase_Model_Order::STATUS_INQUIRY )
             $this->drawTextInBlock($page, $product->getData('hts'), 300, $this->y, 60, 20, 'r');
             $this->drawTextInBlock($page, $order->getCurrency()->formatTxt($item->getpop_price_ht()), 415, $this->y, 60, 20, 'r');
             $this->drawTextInBlock($page, (int) $item->getpop_qty(), 380, $this->y, 40, 20, 'c');
             //if ($order->getpo_status() != MDN_Purchase_Model_Order::STATUS_INQUIRY )
             //{
             //$this->drawTextInBlock($page, $order->getCurrency()->formatTxt($item->getpop_eco_tax()), 365, $this->y, 40, 20, 'c');
             //$this->drawTextInBlock($page, number_format($item->getpop_tax_rate(), 2).'%', 410, $this->y, 40, 20, 'c');
             $this->drawTextInBlock($page, $order->getCurrency()->formatTxt($item->getRowTotal()), 495, $this->y, 60, 20, 'r');
             //$this->drawTextInBlock($page, $order->getCurrency()->formatTxt($item->getRowTotalWithTaxes($order->getpo_tax_rate())), 520, $this->y, 60, 20, 'r');
             //}	        	getProduct()->getsku()
             if ($this->_showPictures) {
                 $this->y -= $this->_pictureSize;
             } else {
                 $this->y -= $this->_ITEM_HEIGHT;
             }
             //si on a plus la place de rajouter le footer, on change de page
             if ($this->y < $this->_BLOC_FOOTER_HAUTEUR + 40) {
                 $this->drawFooter($page);
                 $page = $this->NewPage($settings);
                 $this->drawTableHeader($page);
             }
             if ($product->getData('upc') != '') {
                 $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.2));
                 $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_OBLIQUE), 8);
                 $this->drawTextInBlock($page, 'UPC: ' . $product->getData('upc'), 15, $this->y + 10, 60, 20, 'l');
                 $this->y -= 10;
                 $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.2));
                 $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
             }
         }
         //rajoute les frais d'expédition
         if ($order->getpo_status() != MDN_Purchase_Model_Order::STATUS_INQUIRY) {
             $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10);
             $this->DrawMultilineText($page, mage::helper('purchase')->__('Shipping costs'), 90, $this->y, 10, 0.2, 11);
             //$this->drawTextInBlock($page, number_format($order->getpo_tax_rate(), 2).'%', 410, $this->y, 40, 20, 'c');
             $this->drawTextInBlock($page, $order->getCurrency()->formatTxt($order->getShippingAmountHt()), 450, $this->y, 60, 20, 'r');
             $this->drawTextInBlock($page, $order->getCurrency()->formatTxt($order->getShippingAmountTtc()), 520, $this->y, 60, 20, 'r');
             //rajoute les droits de douane
//.........这里部分代码省略.........
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:101,代码来源:Order.php

示例15: remittanceInvoice

 public function remittanceInvoice($batch_id = 27, $shop_date_remittance = null)
 {
     $user = $this;
     $page_count = 0;
     $footer_added = 0;
     $pdf = new Zend_Pdf();
     $pdf->pages[] = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $page = $pdf->pages[$page_count];
     $style = new Zend_Pdf_Style();
     $style->setLineColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $style->setFont($font, 16);
     $page->setStyle($style);
     $page_height = $page->getHeight();
     $page->drawText('RECIPIENT CREATED TAX INVOICE', 150, $page_height - 80);
     $style->setFont($font, 12);
     $page->setStyle($style);
     $company = trim($user->company) != '' ? $user->company : $user->first_name . ' ' . $user->last_name;
     $address1 = !empty($this->delivery_address1) ? $this->delivery_address1 . ' ' : null;
     $address1 .= !empty($this->delivery_address2) ? $this->delivery_address2 . ' ' : null;
     $address1 .= !empty($this->delivery_city) ? $this->delivery_city . ' ' : null;
     $address2 = !empty($this->delivery_state) ? $this->delivery_state . ', ' : null;
     $address2 .= !empty($this->delivery_postcode) ? $this->delivery_postcode : null;
     $page->drawText($company, 50, $page->getHeight() - 120);
     $page->drawText($address1, 50, $page->getHeight() - 133);
     $page->drawText($address2, 50, $page->getHeight() - 147);
     $page->drawText('ABN # ' . $this->abn, 50, $page->getHeight() - 160);
     $remittanceDate = !empty($shop_date_remittance) ? date('d/m/Y') : date('d/m/Y');
     $invoice_number = $this->id . '-' . $batch_id;
     $page->drawText('Remittance Date: ' . $remittanceDate, 400, $page->getHeight() - 120);
     $page->drawText('Invoice number: ' . $invoice_number, 400, $page->getHeight() - 133);
     $style->setFont($font, 10);
     $page->setStyle($style);
     $page->drawText('Note: only items that were sold with GST applicable will appear on this invoice', 100, $page->getHeight() - 188);
     $head_row_height = 20;
     $row_height = 20;
     $line_height_start = $page_height - 200;
     $total_data_row = 30;
     $page_break_row = 25;
     $textline_height = 12;
     $spModel = Base::getModel('Shop_Products');
     $select = $spModel->select()->setIntegrityCheck(false)->from(array('sp' => 'shop_products'));
     //join with common_items
     $select->join(array('ci' => 'common_items'), 'sp.client_product_id = ci.client_product_id', array('sum(ci.copies) as copies, sum(ci.copies*ci.shop_markup) as shop_markup,  ci.registered_gst as gst', 'ci.registered_gst'));
     $select->where('ci.remittance_batch_id = ?', $batch_id);
     if (!empty($shop_date_remittance)) {
         $select->where('ci.shop_date_remittance = ?', $shop_date_remittance);
     }
     $select->where('sp.common_user_id = ?', $user->id);
     $select->where('ci.registered_gst = 1');
     $select->group(array('sp.common_user_id', 'gst'));
     $shop_markup_inc_gst = $shop_markup_exc_gst = '';
     //Zend_Debug::dump((string)$select); die();
     $rows = $spModel->fetchAll($select);
     $total_data_row = $rows->count();
     $i = 1;
     $j = 1;
     $total_copies = 0;
     $total_Ex_GST = $total_Inc_GST = 0.0;
     foreach ($rows as $row) {
         if ($i == 1) {
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
             $style->setFont($font, 10);
             $page->setStyle($style);
             $page->drawLine(60, $line_height_start, 540, $line_height_start)->drawLine(60, $line_height_start, 60, $line_height_start - $head_row_height)->drawLine(300, $line_height_start, 300, $line_height_start - $head_row_height)->drawLine(360, $line_height_start, 360, $line_height_start - $head_row_height)->drawLine(450, $line_height_start, 450, $line_height_start - $head_row_height)->drawLine(60, $line_height_start - $head_row_height, 540, $line_height_start - $head_row_height)->drawLine(540, $line_height_start, 540, $line_height_start - $head_row_height)->drawText('Description', 68, $line_height_start - $textline_height)->drawText('Copies', 308, $line_height_start - $textline_height)->drawText('Ex-GST Amount', 368, $line_height_start - $textline_height)->drawText('Inc-GST Amount', 458, $line_height_start - $textline_height);
             // Table Headers
             $line_height_start = $line_height_start - $head_row_height;
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
             $style->setFont($font, 10);
             $page->setStyle($style);
         }
         $shop_markup = sprintf("%01.2f", $row->shop_markup);
         $shop_markup_len = strlen($shop_markup);
         $num_pad = 5 * ($shop_markup_len - 4);
         $page->drawLine(60, $line_height_start, 540, $line_height_start)->drawLine(60, $line_height_start, 60, $line_height_start - $row_height)->drawLine(300, $line_height_start, 300, $line_height_start - $row_height)->drawLine(360, $line_height_start, 360, $line_height_start - $row_height)->drawLine(450, $line_height_start, 450, $line_height_start - $row_height)->drawLine(60, $line_height_start - $row_height, 540, $line_height_start - $row_height)->drawLine(540, $line_height_start, 540, $line_height_start - $row_height)->drawText($row->title, 68, $line_height_start - $textline_height)->drawText($row->copies, 330, $line_height_start - $textline_height)->drawText($row->gst == 1 ? sprintf("%01.2f", $shop_markup - $shop_markup / 11) : sprintf("%01.2f", $shop_markup), 425 - $num_pad, $line_height_start - $textline_height)->drawText(sprintf("%01.2f", $shop_markup), 515 - $num_pad, $line_height_start - $textline_height);
         // Table Headers
         $line_height_start = $line_height_start - $row_height;
         $total_copies += $row->copies;
         $total_Inc_GST += $shop_markup;
         if ($row->gst == 1) {
             $total_Ex_GST += $shop_markup - $shop_markup / 11;
         } else {
             $total_Ex_GST += $shop_markup;
         }
         $footer_added = 0;
         if ($j == $total_data_row) {
             $total_Ex_GST = sprintf("%01.2f", $total_Ex_GST);
             $total_Inc_GST = sprintf("%01.2f", $total_Inc_GST);
             $len = strlen($total_Ex_GST);
             $ex_gst_num_pad = 5 * ($len - 4);
             $len = strlen($total_Inc_GST);
             $inc_gst_num_pad = 5 * ($len - 4);
             $len = strlen($total_copies);
             $copies_num_pad = 5 * ($len - 1);
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
             $style->setFont($font, 10);
             $page->setStyle($style);
             $page->drawLine(60, $line_height_start, 540, $line_height_start)->drawLine(60, $line_height_start, 60, $line_height_start - $head_row_height)->drawLine(300, $line_height_start, 300, $line_height_start - $head_row_height)->drawLine(360, $line_height_start, 360, $line_height_start - $head_row_height)->drawLine(450, $line_height_start, 450, $line_height_start - $head_row_height)->drawLine(60, $line_height_start - $head_row_height, 540, $line_height_start - $head_row_height)->drawLine(540, $line_height_start, 540, $line_height_start - $head_row_height)->drawText('Total', 68, $line_height_start - $textline_height)->drawText($total_copies, 330 - $copies_num_pad, $line_height_start - $textline_height)->drawText($total_Ex_GST, 425 - $ex_gst_num_pad, $line_height_start - $textline_height)->drawText($total_Inc_GST, 515 - $inc_gst_num_pad, $line_height_start - $textline_height);
             // Table Headers
             $line_height_start = $line_height_start - $head_row_height;
//.........这里部分代码省略.........
开发者ID:roozbehmatloobi,项目名称:Zend-PHP,代码行数:101,代码来源:Row.php


注:本文中的Zend_Pdf_Style::setFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。