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


PHP Zend_Pdf_Style类代码示例

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


在下文中一共展示了Zend_Pdf_Style类的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: 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

示例3: __construct

 public function __construct($labels = array())
 {
     $cols = null;
     foreach ($labels as $label) {
         $col = new Core_Pdf_Table_Column();
         $col->setText($label);
         $cols[] = $col;
     }
     if ($cols) {
         $this->setColumns($cols);
     }
     //set default alignment
     $this->_align = Core_Pdf::CENTER;
     //set default borders
     $style = new Zend_Pdf_Style();
     $style->setLineWidth(2);
     $this->setBorder(Core_Pdf::BOTTOM, $style);
     $this->setCellPaddings(array(5, 5, 5, 5));
     //set default font
     $this->_font = Zend_Pdf_Font::fontWithName(ZEND_Pdf_Font::FONT_HELVETICA_BOLD);
     $this->_fontSize = 12;
 }
开发者ID:uglide,项目名称:zfcore-transition,代码行数:22,代码来源:HeaderRow.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: 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

示例6: 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

示例7: write

 /**
  * Draws the cell to the PDF page.
  * 
  * This function will parse the internal $_text field and draw the cell to the PDF page.
  */
 public function write()
 {
     if (!$this->_page instanceof Zend_Pdf_Page) {
         throw new Zend_Pdf_Exception("The PDF page that the cell is attempting to write to is not a valid page.");
     }
     if (!$this->_font instanceof Zend_Pdf_Resource_Font) {
         throw new Zend_Pdf_Exception('No font has been set');
     }
     if ($this->isAutoHeight()) {
         $this->_height = $this->_autoHeight;
     }
     if ($this->isAutoWidth()) {
         $this->_width = $this->_autoWidth;
     }
     //positions of the cell's box
     //initalize the diminsions to defaults
     $top = $this->_y;
     $left = $this->_x;
     $right = $left + $this->getWidth();
     $bottom = $top + $this->getHeight();
     if ($this->_position & Zend_Pdf_Cell::POSITION_BOTTOM) {
         $top = $this->getHeight();
         $bottom = $top + $this->getHeight();
     }
     if ($this->_position & Zend_Pdf_Cell::POSITION_CENTER_X) {
         $left = $this->_page->getWidth() / 2 - $this->getWidth() / 2 + $this->_x;
         $right = $left + $this->getWidth();
     }
     if ($this->_position & Zend_Pdf_Cell::POSITION_CENTER_Y) {
         $top = $this->_page->getHeight() / 2 + $this->getHeight() / 2 - $this->_y;
         $bottom = $top - $this->getHeight();
     }
     if ($this->_position & Zend_Pdf_Cell::POSITION_TOP) {
         $top = $this->_page->getHeight();
         $bottom = $top + $this->getHeight();
     }
     if ($this->_position & Zend_Pdf_Cell::POSITION_RIGHT) {
         $left = $this->_page->getWidth() - $this->getWidth();
         $right = $left + $this->getWidth();
     }
     $currentY = $top;
     //save the page's font so we can put it back after writing the cell
     $pageFont = $this->_page->getFont();
     $fontSize = $this->_page->getFontSize();
     //restore old size and font
     $this->_page->setFont($pageFont, $fontSize);
     //draw the border
     if ($this->_border['size'] > 0) {
         $style = new Zend_Pdf_Style();
         $style->setLineColor($this->getBorderColor());
         $style->setFillColor(new Zend_Pdf_Color_RGB(255, 255, 255));
         $style->setLineDashingPattern($this->getBorderPattern());
         $this->_page->setStyle($style);
         $this->_page->drawRectangle($right, $top, $left, $bottom);
         $style->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
         $this->_page->setStyle($style);
     }
     //draw every section of every page.
     for ($i = 0; $i < count($this->_text); $i++) {
         $currentX = 0;
         switch ($this->_text[$i]['alignment']) {
             case Zend_Pdf_Cell::ALIGN_RIGHT:
                 $currentX = $right - $this->_text[$i]['width'];
                 break;
             case Zend_Pdf_Cell::ALIGN_CENTER:
                 $currentX = ($right - $left) / 2 + $left - $this->_text[$i]['width'] / 2;
                 break;
             case Zend_Pdf_Cell::ALIGN_JUSTIFY:
                 //@todo
                 break;
             default:
                 $currentX = $left;
                 break;
         }
         //add the offset
         $currentX += $this->_text[$i]['x'];
         $currentY -= $this->_text[$i]['height'];
         //count() - 4 because of the 4 properties to this text.
         for ($j = 0; $j < count($this->_text[$i]) - 4; $j++) {
             $this->_page->setFont($this->_text[$i][$j]['font'], $this->_text[$i][$j]['fontSize']);
             $this->_page->drawText($this->_text[$i][$j]['text'], $currentX, $currentY, $this->_text[$i][$j]['encoding']);
             $currentX += $this->_text[$i][$j]['width'];
         }
     }
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:90,代码来源:Cell.php

示例8: foreach

        // save
    }
} 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
开发者ID:O-R-G,项目名称:servinglibrary.org,代码行数:31,代码来源:download.php

示例9: 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

示例10: 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

示例11: Zend_Pdf_Style

 //         $page1->setStyle($style)
 //         ->drawText($kh, 50,500 + $page, $charEncoding = 'UTF-8');
 //         $page = $page + 20;
 //     }
 $page1->setStyle($style)->drawText('DAI HOC BACH KHOA TP.HO CHI MINH', 180, 800, $charEncoding = 'UTF-8');
 // define image resource
 $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;
开发者ID:LongNguyen-51101909,项目名称:Zend1Example,代码行数:31,代码来源:data.php

示例12: 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

示例13: getPdf

 public function getPdf($invoices = array())
 {
     $pdf = new Zend_Pdf();
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10);
     foreach ($invoices as $invoice) {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
         $pdf->pages[] = $page;
         $order = $invoice->getOrder();
         /* Add image */
         $this->insertLogo($page);
         /* Add address */
         $this->insertAddress($page);
         /* Add head */
         $this->insertOrder($page, $order);
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
         $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7);
         $page->drawText(Mage::helper('sales')->__('Invoice # ') . $invoice->getIncrementId(), 35, 780);
         /* Add table */
         $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
         $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
         $page->setLineWidth(0.5);
         $page->drawRectangle(25, $this->y, 570, $this->y - 15);
         $this->y -= 10;
         /* Add table head */
         $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
         $page->drawText(Mage::helper('sales')->__('QTY'), 35, $this->y);
         $page->drawText(Mage::helper('sales')->__('Products'), 60, $this->y);
         $page->drawText(Mage::helper('sales')->__('SKU'), 380, $this->y);
         $page->drawText(Mage::helper('sales')->__('Total(inc)'), 530, $this->y);
         $this->y -= 15;
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         /* Add body */
         foreach ($invoice->getAllItems() as $item) {
             $shift = 10;
             if ($this->y < 15) {
                 /* Add new table head */
                 $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
                 $pdf->pages[] = $page;
                 $this->y = 800;
                 $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7);
                 $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
                 $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
                 $page->setLineWidth(0.5);
                 $page->drawRectangle(25, $this->y, 570, $this->y - 15);
                 $this->y -= 10;
                 $page->setFillColor(new Zend_Pdf_Color_RGB(0.4, 0.4, 0.4));
                 $page->drawText(Mage::helper('sales')->__('QTY'), 35, $this->y);
                 $page->drawText(Mage::helper('sales')->__('Products'), 60, $this->y);
                 $page->drawText(Mage::helper('sales')->__('SKU'), 380, $this->y);
                 $page->drawText(Mage::helper('sales')->__('Price'), 530, $this->y);
                 $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
                 $this->y -= 20;
             }
             /* Add products */
             $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7);
             $page->drawText($item->getQty() * 1, 35, $this->y);
             $page->drawText($item->getName(), 60, $this->y);
             foreach (explode('</li>', $item->getDescription()) as $description) {
                 $page->drawText(strip_tags($description), 65, $this->y - $shift);
                 $shift += 10;
             }
             $page->drawText($item->getSku(), 380, $this->y);
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
             $row_total = $order->formatPriceTxt($item->getRowTotal() + $item->getTaxAmount() - $item->getDiscountAmount());
             $page->drawText($row_total, 565 - $this->widthForStringUsingFontSize($row_total, $font, 7), $this->y);
             $this->y -= $shift;
         }
         /* Add totals */
         $this->insertTotals($page, $invoice);
     }
     return $pdf;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:73,代码来源:Invoice.php

示例14: deploy

 public function deploy()
 {
     $this->checkExportRights();
     $this->setRecordsPerPage(0);
     parent::deploy();
     $width = 0;
     $colors = array('title' => '#000000', 'subtitle' => '#111111', 'footer' => '#111111', 'header' => '#AAAAAA', 'row1' => '#EEEEEE', 'row2' => '#FFFFFF', 'sqlexp' => '#BBBBBB', 'lines' => '#111111', 'hrow' => '#E4E4F6', 'text' => '#000000', 'filters' => '#F9EDD2', 'filtersBox' => '#DEDEDE');
     $this->_deploy['colors'] = array_merge($colors, (array) $this->_deploy['colors']);
     $la = '';
     if (!isset($this->_deploy['save'])) {
         $this->_deploy['save'] = false;
     }
     if (!isset($this->_deploy['download'])) {
         $this->_deploy['download'] = false;
     }
     if ($this->_deploy['save'] != 1 && $this->_deploy['download'] != 1) {
         throw new Exception('Nothing to do. Please specify download&&|save options');
     }
     if (empty($this->_deploy['name'])) {
         $this->_deploy['name'] = date('H_m_d_H_i_s');
     }
     if (substr($this->_deploy['name'], -4) == '.xls') {
         $this->_deploy['name'] = substr($this->_deploy['name'], 0, -4);
     }
     if (!isset($this->_deploy['noPagination'])) {
         $this->_deploy['noPagination'] = 0;
     }
     $this->_deploy['dir'] = rtrim($this->_deploy['dir'], '/') . '/';
     if (!isset($this->_deploy['dir']) || !is_dir($this->_deploy['dir'])) {
         throw new Bvb_Grid_Exception($this->_deploy['dir'] . ' is not a dir');
     }
     if (!is_writable($this->_deploy['dir'])) {
         throw new Bvb_Grid_Exception($this->_deploy['dir'] . ' is not writable');
     }
     $larg = self::calculateCellSize();
     $lengthTotal = array_sum($larg);
     $cellFontSize = 8;
     //set font
     $titulos = parent::_buildTitles();
     $sql = parent::_buildSqlExp();
     $grid = parent::_BuildGrid();
     if (!$this->getInfo('hRow,field')) {
         $this->_info['hRow']['field'] = '';
     }
     if (strtoupper($this->_deploy['orientation']) == 'LANDSCAPE' && strtoupper($this->_deploy['size']) == 'A4') {
         $totalPaginas = ceil(count($grid) / 26);
     } elseif (strtoupper($this->_deploy['orientation']) == 'LANDSCAPE' && strtoupper($this->_deploy['size']) == 'LETTER') {
         $totalPaginas = ceil(count($grid) / 27);
     } else {
         $totalPaginas = ceil(count($grid) / 37);
     }
     if ($totalPaginas < 1) {
         $totalPaginas = 1;
     }
     $pdf = new Zend_Pdf();
     // Create new Style
     $style = new Zend_Pdf_Style();
     $style->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['lines']));
     $topo = new Zend_Pdf_Style();
     $topo->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['header']));
     $td = new Zend_Pdf_Style();
     $td->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['row2']));
     $styleFilters = new Zend_Pdf_Style();
     $styleFilters->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['filters']));
     $styleFiltersBox = new Zend_Pdf_Style();
     $styleFiltersBox->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['filtersBox']));
     $td2 = new Zend_Pdf_Style();
     $td2->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['row1']));
     $hRowStyle = new Zend_Pdf_Style();
     $hRowStyle->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['hrow']));
     $styleSql = new Zend_Pdf_Style();
     $styleSql->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['sqlexp']));
     $styleText = new Zend_Pdf_Style();
     $styleText->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['text']));
     // Add new page to the document
     if (strtoupper($this->_deploy['size'] = 'LETTER') && strtoupper($this->_deploy['orientation']) == 'LANDSCAPE') {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
     } elseif (strtoupper($this->_deploy['size'] = 'LETTER') && strtoupper($this->_deploy['orientation']) != 'LANDSCAPE') {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER);
     } elseif (strtoupper($this->_deploy['size'] != 'A4') && strtoupper($this->_deploy['orientation']) == 'LANDSCAPE') {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     } else {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     }
     $page->setStyle($style);
     $pdf->pages[] = $page;
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     $page->setFont($font, 14);
     //$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     if (file_exists($this->_deploy['logo'])) {
         $image = Zend_Pdf_Image::imageWithPath($this->_deploy['logo']);
         list($width, $height, $type, $attr) = getimagesize($this->_deploy['logo']);
         $page->drawImage($image, 40, $page->getHeight() - $height - 40, 40 + $width, $page->getHeight() - 40);
     }
     $page->drawText($this->__($this->_deploy['title']), $width + 70, $page->getHeight() - 70, $this->getCharEncoding());
     $page->setFont($font, $cellFontSize);
     $page->drawText($this->__($this->_deploy['subtitle']), $width + 70, $page->getHeight() - 80, $this->getCharEncoding());
     //Iniciar a contagem de páginas
     $pagina = 1;
     $page->drawText($this->_deploy['footer'], 40, 40, $this->getCharEncoding());
//.........这里部分代码省略.........
开发者ID:robjacoby,项目名称:xlr8u,代码行数:101,代码来源:Pdf.php

示例15: __construct

 public function __construct($param1, $param2 = null, $param3 = null)
 {
     parent::__construct($param1, $param2, $param3);
     $style = new Zend_Pdf_Style();
     $style->setLineColor(new Zend_Pdf_Color_Html("#000000"));
     $style->setFillColor(new Zend_Pdf_Color_Html("#000000"));
     $style->setLineWidth(0.5);
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
     $style->setFont($font, 10);
     $style->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID);
     $this->_defaultStyle = $style;
     $this->setStyle($style);
 }
开发者ID:uglide,项目名称:zfcore-transition,代码行数:13,代码来源:Page.php


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