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


PHP Zend_Pdf_Page::drawRectangle方法代码示例

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


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

示例1: addServiceFeaturesCodes

 /**
  * Add Service Features Codes
  *
  * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder
  * @throws Zend_Pdf_Exception
  */
 public function addServiceFeaturesCodes()
 {
     $this->_page->saveGS();
     $this->_page->drawRectangle($this->_x(0), $this->_y(195), $this->_x(218), $this->_y(217), Zend_Pdf_Page::SHAPE_DRAW_FILL);
     $this->_page->restoreGS();
     return $this;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:13,代码来源:PageBuilder.php

示例2: testDrawing

 public function testDrawing()
 {
     $pdf = new Zend_Pdf();
     // Add new page generated by Zend_Pdf object (page is attached to the specified the document)
     $pdf->pages[] = $page1 = $pdf->newPage('A4');
     // Add new page generated by Zend_Pdf_Page object (page is not attached to the document)
     $pdf->pages[] = $page2 = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
     // Create new font
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     // Apply font and draw text
     $page1->setFont($font, 36);
     $page1->setFillColor(Zend_Pdf_Color_Html::color('#9999cc'));
     $page1->drawText('Helvetica 36 text string', 60, 500);
     // Use font object for another page
     $page2->setFont($font, 24);
     $page2->drawText('Helvetica 24 text string', 60, 500);
     // Use another font
     $page2->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES), 32);
     $page2->drawText('Times-Roman 32 text string', 60, 450);
     // Draw rectangle
     $page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8));
     $page2->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
     $page2->setLineDashingPattern(array(3, 2, 3, 4), 1.6);
     $page2->drawRectangle(60, 400, 400, 350);
     // Draw circle
     $page2->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID);
     $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
     $page2->drawCircle(85, 375, 25);
     // Draw sectors
     $page2->drawCircle(200, 375, 25, 2 * M_PI / 3, -M_PI / 6);
     $page2->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0));
     $page2->drawCircle(200, 375, 25, M_PI / 6, 2 * M_PI / 3);
     $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0));
     $page2->drawCircle(200, 375, 25, -M_PI / 6, M_PI / 6);
     // Draw ellipse
     $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
     $page2->drawEllipse(250, 400, 400, 350);
     $page2->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0));
     $page2->drawEllipse(250, 400, 400, 350, M_PI / 6, 2 * M_PI / 3);
     $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0));
     $page2->drawEllipse(250, 400, 400, 350, -M_PI / 6, M_PI / 6);
     // Draw and fill polygon
     $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1));
     $x = array();
     $y = array();
     for ($count = 0; $count < 8; $count++) {
         $x[] = 140 + 25 * cos(3 * M_PI_4 * $count);
         $y[] = 375 + 25 * sin(3 * M_PI_4 * $count);
     }
     $page2->drawPolygon($x, $y, Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE, Zend_Pdf_Page::FILL_METHOD_EVEN_ODD);
     // Draw line
     $page2->setLineWidth(0.5);
     $page2->drawLine(60, 375, 400, 375);
     $pdf->save(dirname(__FILE__) . '/_files/output.pdf');
     unset($pdf);
     $pdf1 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output.pdf');
     $this->assertTrue($pdf1 instanceof Zend_Pdf);
     unset($pdf1);
     unlink(dirname(__FILE__) . '/_files/output.pdf');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:60,代码来源:DrawingTest.php

示例3: drawFont

 protected function drawFont($object)
 {
     $fontItem = $object->getItem();
     if ($fontItem->getFace() == 'bold') {
         $fontDecoration = 'bold';
     } else {
         $fontDecoration = 'regular';
     }
     $fontPath = SERVER_BASE . '/fonts/' . $fontItem->getName() . '.ttf';
     if (is_file($fontPath)) {
         $font = Zend_Pdf_Font::fontWithPath($fontPath, Zend_Pdf_Font::EMBED_SUPPRESS_EMBED_EXCEPTION);
     } else {
         if ($fontDecoration == "bold") {
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
         } else {
             $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
         }
     }
     if ($fontItem->getFace() == "invert") {
         $this->page->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
         //schwarze farbe setzen fuer Hintergrund
         $width = $this->widthForStringUsingFontSize($object->getValue(), $font, $fontItem->getSize());
         $height = $fontItem->getSize();
         $this->page->drawRectangle($this->coordX($this->mmToPts($object->getPosx())), $this->coordY($this->mmToPts($object->getPosy())) + $height / 2, $this->coordX($this->mmToPts($object->getPosx())) + $width, $this->coordY($this->mmToPts($object->getPosy())) - $height / 2, Zend_Pdf_Page::SHAPE_DRAW_FILL);
         $this->page->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 1));
         //weiße farbe setzen fuer Text
     } else {
         $this->page->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
         //schwarze farbe setzen fuer text
     }
     $this->page->setFont($font, $fontItem->getSize());
     if ($fontItem->getRotation() !== null) {
         $this->page->rotate($this->coordX($this->mmToPts($object->getPosx())), $this->coordY($this->mmToPts($object->getPosy())), deg2rad(360 - $fontItem->getRotation()));
     }
     $this->page->drawText($object->getValue(), $this->coordX($this->mmToPts($object->getPosx())), $this->coordY($this->mmToPts($object->getPosy()) + $fontItem->getSize() / 2), 'UTF-8');
     if ($fontItem->getRotation() !== null) {
         $this->page->rotate($this->coordX($this->mmToPts($object->getPosx())), $this->coordY($this->mmToPts($object->getPosy())), -deg2rad(360 - $fontItem->getRotation()));
     }
 }
开发者ID:Blackbam1337,项目名称:phpGlsUniboxShippingLabels,代码行数:39,代码来源:Gls_Unibox_Model_Pdf_Abstract.php

示例4: _drawPackageBlock

 /**
  * Draw packages block
  *
  * @param  \Zend_Pdf_Page $page
  * @return \Magento\Shipping\Model\Order\Pdf\Packaging
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 protected function _drawPackageBlock(\Zend_Pdf_Page $page)
 {
     if ($this->getPackageShippingBlock()) {
         $packaging = $this->getPackageShippingBlock();
     } else {
         $packaging = $this->_layout->getBlockSingleton('Magento\\Shipping\\Block\\Adminhtml\\Order\\Packaging');
     }
     $packages = $packaging->getPackages();
     $packageNum = 1;
     foreach ($packages as $package) {
         $page->setFillColor(new \Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
         $page->drawRectangle(25, $this->y + 15, 190, $this->y - 35);
         $page->drawRectangle(190, $this->y + 15, 350, $this->y - 35);
         $page->drawRectangle(350, $this->y + 15, 570, $this->y - 35);
         $page->setFillColor(new \Zend_Pdf_Color_GrayScale(1));
         $page->drawRectangle(520, $this->y + 15, 570, $this->y - 5);
         $page->setFillColor(new \Zend_Pdf_Color_GrayScale(0));
         $packageText = __('Package') . ' ' . $packageNum;
         $page->drawText($packageText, 525, $this->y, 'UTF-8');
         $packageNum++;
         $package = new \Magento\Framework\DataObject($package);
         $params = new \Magento\Framework\DataObject($package->getParams());
         $dimensionUnits = $this->_carrierHelper->getMeasureDimensionName($params->getDimensionUnits());
         $typeText = __('Type') . ' : ' . $packaging->getContainerTypeByCode($params->getContainer());
         $page->drawText($typeText, 35, $this->y, 'UTF-8');
         if ($params->getLength() != null) {
             $lengthText = $params->getLength() . ' ' . $dimensionUnits;
         } else {
             $lengthText = '--';
         }
         $lengthText = __('Length') . ' : ' . $lengthText;
         $page->drawText($lengthText, 200, $this->y, 'UTF-8');
         if ($params->getDeliveryConfirmation() != null) {
             $confirmationText = __('Signature Confirmation') . ' : ' . $packaging->getDeliveryConfirmationTypeByCode($params->getDeliveryConfirmation());
             $page->drawText($confirmationText, 355, $this->y, 'UTF-8');
         }
         $this->y = $this->y - 10;
         if ($packaging->displayCustomsValue() != null) {
             $customsValueText = __('Customs Value') . ' : ' . $packaging->displayPrice($params->getCustomsValue());
             $page->drawText($customsValueText, 35, $this->y, 'UTF-8');
         }
         if ($params->getWidth() != null) {
             $widthText = $params->getWidth() . ' ' . $dimensionUnits;
         } else {
             $widthText = '--';
         }
         $widthText = __('Width') . ' : ' . $widthText;
         $page->drawText($widthText, 200, $this->y, 'UTF-8');
         if ($params->getContentType() != null) {
             if ($params->getContentType() == 'OTHER') {
                 $contentsValue = $params->getContentTypeOther();
             } else {
                 $contentsValue = $packaging->getContentTypeByCode($params->getContentType());
             }
             $contentsText = __('Contents') . ' : ' . $contentsValue;
             $page->drawText($contentsText, 355, $this->y, 'UTF-8');
         }
         $this->y = $this->y - 10;
         $weightText = __('Total Weight') . ' : ' . $params->getWeight() . ' ' . $this->_carrierHelper->getMeasureWeightName($params->getWeightUnits());
         $page->drawText($weightText, 35, $this->y, 'UTF-8');
         if ($params->getHeight() != null) {
             $heightText = $params->getHeight() . ' ' . $dimensionUnits;
         } else {
             $heightText = '--';
         }
         $heightText = __('Height') . ' : ' . $heightText;
         $page->drawText($heightText, 200, $this->y, 'UTF-8');
         $this->y = $this->y - 10;
         if ($params->getSize()) {
             $sizeText = __('Size') . ' : ' . ucfirst(strtolower($params->getSize()));
             $page->drawText($sizeText, 35, $this->y, 'UTF-8');
         }
         if ($params->getGirth() != null) {
             $dimensionGirthUnits = $this->_carrierHelper->getMeasureDimensionName($params->getGirthDimensionUnits());
             $girthText = __('Girth') . ' : ' . $params->getGirth() . ' ' . $dimensionGirthUnits;
             $page->drawText($girthText, 200, $this->y, 'UTF-8');
         }
         $this->y = $this->y - 5;
         $page->setFillColor(new \Zend_Pdf_Color_GrayScale(1));
         $page->drawRectangle(25, $this->y, 570, $this->y - 30 - count($package->getItems()) * 12);
         $this->y = $this->y - 10;
         $page->setFillColor(new \Zend_Pdf_Color_GrayScale(0));
         $page->drawText(__('Items in the Package'), 30, $this->y, 'UTF-8');
         $txtIndent = 5;
         $itemCollsNumber = $packaging->displayCustomsValue() ? 5 : 4;
         $itemCollsX[0] = 30;
         //  coordinate for Product name
         $itemCollsX[1] = 250;
         // coordinate for Product name
         $itemCollsXEnd = 565;
//.........这里部分代码省略.........
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:101,代码来源:Packaging.php

示例5: insertOrder

 /**
  * Insert order to pdf page
  *
  * @param Zend_Pdf_Page $page
  * @param Mage_Sales_Model_Order $obj
  * @param bool $putOrderId
  */
 protected function insertOrder(&$page, $obj, $putOrderId = true)
 {
     if ($obj instanceof Mage_Sales_Model_Order) {
         $shipment = null;
         $order = $obj;
     } elseif ($obj instanceof Mage_Sales_Model_Order_Shipment) {
         $shipment = $obj;
         $order = $shipment->getOrder();
     }
     $this->y = $this->y ? $this->y : 815;
     $top = $this->y;
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.45));
     $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.45));
     $page->drawRectangle(25, $top, 570, $top - 55);
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
     $this->setDocHeaderCoordinates(array(25, $top, 570, $top - 55));
     $this->_setFontRegular($page, 10);
     if ($putOrderId) {
         $page->drawText(Mage::helper('sales')->__('Order # ') . $order->getRealOrderId(), 35, $top -= 30, 'UTF-8');
     }
     $page->drawText(Mage::helper('sales')->__('Order Date: ') . Mage::helper('core')->formatDate($order->getCreatedAtStoreDate(), 'medium', false), 35, $top -= 15, 'UTF-8');
     $top -= 10;
     $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, $top, 275, $top - 25);
     $page->drawRectangle(275, $top, 570, $top - 25);
     /* Calculate blocks info */
     /* Billing Address */
     $billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
     /* Payment */
     $paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())->setIsSecureMode(true)->toPdf();
     $paymentInfo = htmlspecialchars_decode($paymentInfo, ENT_QUOTES);
     $payment = explode('{{pdf_row_separator}}', $paymentInfo);
     foreach ($payment as $key => $value) {
         if (strip_tags(trim($value)) == '') {
             unset($payment[$key]);
         }
     }
     reset($payment);
     /* Shipping Address and Method */
     if (!$order->getIsVirtual()) {
         /* Shipping Address */
         $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
         $shippingMethod = $order->getShippingDescription();
     }
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $this->_setFontBold($page, 12);
     $page->drawText(Mage::helper('sales')->__('Sold to:'), 35, $top - 15, 'UTF-8');
     if (!$order->getIsVirtual()) {
         $page->drawText(Mage::helper('sales')->__('Ship to:'), 285, $top - 15, 'UTF-8');
     } else {
         $page->drawText(Mage::helper('sales')->__('Payment Method:'), 285, $top - 15, 'UTF-8');
     }
     $addressesHeight = $this->_calcAddressHeight($billingAddress);
     if (isset($shippingAddress)) {
         $addressesHeight = max($addressesHeight, $this->_calcAddressHeight($shippingAddress));
     }
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
     $page->drawRectangle(25, $top - 25, 570, $top - 33 - $addressesHeight);
     $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $this->_setFontRegular($page, 10);
     $this->y = $top - 40;
     $addressesStartY = $this->y;
     foreach ($billingAddress as $value) {
         if ($value !== '') {
             $text = array();
             foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
                 $text[] = $_value;
             }
             foreach ($text as $part) {
                 $page->drawText(strip_tags(ltrim($part)), 35, $this->y, 'UTF-8');
                 $this->y -= 15;
             }
         }
     }
     $addressesEndY = $this->y;
     if (!$order->getIsVirtual()) {
         $this->y = $addressesStartY;
         foreach ($shippingAddress as $value) {
             if ($value !== '') {
                 $text = array();
                 foreach (Mage::helper('core/string')->str_split($value, 45, true, true) as $_value) {
                     $text[] = $_value;
                 }
                 foreach ($text as $part) {
                     $page->drawText(strip_tags(ltrim($part)), 285, $this->y, 'UTF-8');
                     $this->y -= 15;
                 }
             }
         }
         $addressesEndY = min($addressesEndY, $this->y);
         $this->y = $addressesEndY;
//.........这里部分代码省略.........
开发者ID:blazeriaz,项目名称:youguess,代码行数:101,代码来源:Abstract.php

示例6:

$page1->setFillColor(Zend_Pdf_Color_Html::color('#9999cc'));
$page1->drawText('Helvetica 36 text string', 60, 500);

// Use font object for another page
$page2->setFont($font, 24);
$page2->drawText('Helvetica 24 text string', 60, 500);

// Use another font
$page2->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES), 32);
$page2->drawText('Times-Roman 32 text string', 60, 450);

// Draw rectangle
$page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8));
$page2->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
$page2->setLineDashingPattern(array(3, 2, 3, 4), 1.6);
$page2->drawRectangle(60, 400, 400, 350);

// Draw circle
$page2->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID);
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
$page2->drawCircle(85, 375, 25);

// Draw sectors
$page2->drawCircle(200, 375, 25, 2*M_PI/3, -M_PI/6);
$page2->setFillColor(new Zend_Pdf_Color_Cmyk(1, 0, 0, 0));
$page2->drawCircle(200, 375, 25, M_PI/6, 2*M_PI/3);
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 1, 0));
$page2->drawCircle(200, 375, 25, -M_PI/6, M_PI/6);

// Draw ellipse
$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
开发者ID:jorgenils,项目名称:zend-framework,代码行数:31,代码来源:demo.php

示例7: stampOnePage

 /**
  * Apply stamp on one page with given style.
  * 
  * @param Zend_Pdf_Page  $page
  * @param Zend_Pdf_Style $style
  * @param String         $stamp
  * 
  * @return void
  */
 protected function stampOnePage($page, $style, $stamp)
 {
     $height = $page->getHeight();
     $page->setStyle($style);
     $page->drawRectangle(40, 40, 60, $height - 40, Zend_Pdf_Page::SHAPE_DRAW_STROKE);
     $page->rotate(20, 20, 1.57);
     $page->drawText($stamp, 50, -10);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:17,代码来源:DocmanWatermark_Stamper.class.php

示例8: insertTableHeader

 /**
  * insert the table header of the shipment
  *
  * @param Zend_Pdf_Page $page page to write on
  */
 protected function insertTableHeader($page)
 {
     $page->setFillColor($this->colors['grey1']);
     $page->setLineColor($this->colors['grey1']);
     $page->setLineWidth(1);
     $page->drawRectangle($this->margin['left'], $this->y, $this->margin['right'] - 10, $this->y - 15);
     $page->setFillColor($this->colors['black']);
     $this->_setFontRegular($page, 9);
     $this->y -= 11;
     $page->drawText(Mage::helper('firegento_pdf')->__('No.'), $this->margin['left'], $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('Description'), $this->margin['left'] + 105, $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('Qty'), $this->margin['left'] + 450, $this->y, $this->encoding);
 }
开发者ID:codedge,项目名称:firegento-pdf,代码行数:18,代码来源:Default.php

示例9: _drawHeader

 /**
  * Draw table header for product items
  *
  * @param  Zend_Pdf_Page $page page to draw on
  *
  * @return void
  */
 protected function _drawHeader(Zend_Pdf_Page $page)
 {
     $page->setFillColor($this->colors['grey1']);
     $page->setLineColor($this->colors['grey1']);
     $page->setLineWidth(1);
     $page->drawRectangle($this->margin['left'], $this->y, $this->margin['right'], $this->y - 15);
     $page->setFillColor($this->colors['black']);
     $font = $this->_setFontRegular($page, 9);
     $this->y -= 11;
     $page->drawText(Mage::helper('firegento_pdf')->__('Pos'), $this->margin['left'] + 3, $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('No.'), $this->margin['left'] + 25, $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('Description'), $this->margin['left'] + 120, $this->y, $this->encoding);
     $singlePrice = Mage::helper('firegento_pdf')->__('Price (excl. tax)');
     $page->drawText($singlePrice, $this->margin['right'] - 153 - $this->widthForStringUsingFontSize($singlePrice, $font, 9), $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('Qty'), $this->margin['left'] + 360, $this->y, $this->encoding);
     $taxLabel = Mage::helper('firegento_pdf')->__('Tax');
     $page->drawText($taxLabel, $this->margin['right'] - 65 - $this->widthForStringUsingFontSize($taxLabel, $font, 9), $this->y, $this->encoding);
     $totalLabel = Mage::helper('firegento_pdf')->__('Total');
     $page->drawText($totalLabel, $this->margin['right'] - 10 - $this->widthForStringUsingFontSize($totalLabel, $font, 10), $this->y, $this->encoding);
 }
开发者ID:brentwpeterson,项目名称:firegento-pdf,代码行数:27,代码来源:Default.php

示例10: insertOrder

 /**
  * @refactor big method, code from 'if' can move to helper
  * @param Zend_Pdf_Page $page
  * @param Mage_Sales_Model_Order $obj
  * @param bool $putOrderId
  */
 protected function insertOrder(&$page, $obj, $putOrderId = true)
 {
     if (version_compare(Mage::getVersion(), '1.7.0', '<')) {
         if ($obj instanceof Mage_Sales_Model_Order) {
             $shipment = null;
             $order = $obj;
         } elseif ($obj instanceof Mage_Sales_Model_Order_Shipment) {
             $shipment = $obj;
             $order = $shipment->getOrder();
         }
         /* @var $order Mage_Sales_Model_Order */
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.5));
         $page->drawRectangle(25, 790, 570, 755);
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
         $this->_setFontRegular($page);
         if ($putOrderId) {
             $page->drawText(Mage::helper('sales')->__('Order # ') . $order->getRealOrderId(), 35, 770, 'UTF-8');
         }
         //$page->drawText(Mage::helper('sales')->__('Order Date: ') . date( 'D M j Y', strtotime( $order->getCreatedAt() ) ), 35, 760, 'UTF-8');
         $page->drawText(Mage::helper('sales')->__('Order Date: ') . Mage::helper('core')->formatDate($order->getCreatedAtStoreDate(), 'medium', false), 35, 760, 'UTF-8');
         $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, 755, 275, 730);
         $page->drawRectangle(275, 755, 570, 730);
         /* Calculate blocks info */
         /* Billing Address */
         $billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf'));
         /* Payment */
         $paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())->setIsSecureMode(true)->toPdf();
         $payment = explode('{{pdf_row_separator}}', $paymentInfo);
         foreach ($payment as $key => $value) {
             if (strip_tags(trim($value)) == '') {
                 unset($payment[$key]);
             }
         }
         reset($payment);
         /* Shipping Address and Method */
         if (!$order->getIsVirtual()) {
             /* Shipping Address */
             $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf'));
             $shippingMethod = $order->getShippingDescription();
         }
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         $this->_setFontRegular($page);
         $page->drawText(Mage::helper('sales')->__('SOLD TO:'), 35, 740, 'UTF-8');
         if (!$order->getIsVirtual()) {
             $page->drawText(Mage::helper('sales')->__('SHIP TO:'), 285, 740, 'UTF-8');
         } else {
             $page->drawText(Mage::helper('sales')->__('Payment Method:'), 285, 740, 'UTF-8');
         }
         if (!$order->getIsVirtual()) {
             $y = 730 - (max(count($billingAddress), count($shippingAddress)) * 10 + 5);
         } else {
             $y = 730 - (count($billingAddress) * 10 + 5);
         }
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
         $page->drawRectangle(25, 730, 570, $y);
         $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         $this->_setFontRegular($page);
         $this->y = 720;
         foreach ($billingAddress as $value) {
             if ($value !== '') {
                 $page->drawText(strip_tags(ltrim($value)), 35, $this->y, 'UTF-8');
                 $this->y -= 10;
             }
         }
         if (!$order->getIsVirtual()) {
             if (Mage::helper('aitconfcheckout')->getShippingEnabled() || Mage::getStoreConfig('aitconfcheckout/shipping/copytoshipping')) {
                 $this->y = 720;
             }
             foreach ($shippingAddress as $value) {
                 if ($value !== '') {
                     $page->drawText(strip_tags(ltrim($value)), 285, $this->y, 'UTF-8');
                     $this->y -= 10;
                 }
             }
             $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
             $page->setLineWidth(0.5);
             $page->drawRectangle(25, $this->y, 275, $this->y - 25);
             $page->drawRectangle(275, $this->y, 570, $this->y - 25);
             $this->y -= 15;
             $this->_setFontBold($page);
             $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
             $page->drawText(Mage::helper('sales')->__('Payment Method'), 35, $this->y, 'UTF-8');
             $page->drawText(Mage::helper('sales')->__('Shipping Method:'), 285, $this->y, 'UTF-8');
             $this->y -= 10;
             $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
             $this->_setFontRegular($page);
             $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
             $paymentLeft = 35;
             $yPayments = $this->y - 15;
         } else {
             $yPayments = 720;
//.........这里部分代码省略.........
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:101,代码来源:Mage_Sales_Model_Order_Pdf_Invoice.php

示例11: drawRectangle

 /**
  * Draw Rectangle
  * @param $xStart
  * @param $yStart
  * @param $xEnd
  * @param $yEnd
  * @param int $fillType
  * @param bool $inContentArea
  * @return Core_Pdf_Page|Zend_Pdf_Canvas_Interface
  */
 public function drawRectangle($xStart, $yStart, $xEnd, $yEnd, $fillType = Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE, $inContentArea = false)
 {
     //move origin
     if ($inContentArea) {
         $topMargin = $this->getMargin(Core_Pdf::TOP);
         $yStart = $this->getHeight() - $yStart - $topMargin;
         $yEnd = $this->getHeight() - $yEnd - $topMargin;
         $xStart = $xStart + $this->getMargin(Core_Pdf::LEFT);
         $xEnd = $xEnd + $this->getMargin(Core_Pdf::LEFT);
     }
     return parent::drawRectangle($xStart, $yStart, $xEnd, $yEnd, $fillType);
 }
开发者ID:uglide,项目名称:zfcore-transition,代码行数:22,代码来源:Page.php

示例12: DrawItems

 protected static function DrawItems(Zend_Pdf_Page $objPage, $objContributionAmountArray, $intY)
 {
     $intXArray = array(20, 92, 200, 308, 465);
     $objPage->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
     $objPage->setFillColor(new Zend_Pdf_Color_GrayScale(0.2));
     $objPage->drawRectangle($intXArray[0] - 6, $intY, $intXArray[4] + 6, $intY - 10);
     $intY -= 7.5;
     $objPage->setFillColor(new Zend_Pdf_Color_GrayScale(1));
     $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 7);
     $objPage->drawText('POSTED DATE', $intXArray[0], $intY, 'UTF-8');
     $objPage->drawText('CONTRIBUTED BY', $intXArray[1], $intY, 'UTF-8');
     $objPage->drawText('FUND', $intXArray[2], $intY, 'UTF-8');
     $objPage->drawText('TRANSACTION', $intXArray[3], $intY, 'UTF-8');
     self::DrawTextRight($objPage, $intXArray[4], $intY, 'AMOUNT');
     $objPage->setFillColor(new Zend_Pdf_Color_GrayScale(0));
     $intY -= 3.5;
     $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 9);
     foreach ($objContributionAmountArray as $objAmount) {
         $intY -= 10;
         $objPage->drawText($objAmount->StewardshipContribution->DateCredited->ToString('MMM D YYYY'), $intXArray[0], $intY, 'UTF-8');
         $objPage->drawText($objAmount->StewardshipContribution->Person->Name, $intXArray[1], $intY, 'UTF-8');
         $objPage->drawText($objAmount->StewardshipFund->Name, $intXArray[2], $intY, 'UTF-8');
         $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7.5);
         $objPage->drawText($objAmount->StewardshipContribution->TransactionShort, $intXArray[3], $intY, 'UTF-8');
         $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 9);
         $strAmount = QApplication::DisplayCurrency($objAmount->Amount);
         if ($objAmount->StewardshipContribution->NonDeductibleFlag) {
             $strAmount = $strAmount . ' (*)';
         }
         self::DrawTextRight($objPage, $intXArray[4], $intY, $strAmount);
     }
 }
开发者ID:alcf,项目名称:chms,代码行数:32,代码来源:StewardshipContribution.class.php

示例13: insertTableHeader

 /**
  * Insert Table Header for Items
  *
  * @param  Zend_Pdf_Page $page current page object of Zend_PDF
  *
  * @return void
  */
 protected function insertTableHeader(&$page)
 {
     $page->setFillColor($this->colors['grey1']);
     $page->setLineColor($this->colors['grey1']);
     $page->setLineWidth(1);
     $page->drawRectangle($this->margin['left'], $this->y, $this->margin['right'], $this->y - 15);
     $page->setFillColor($this->colors['black']);
     $font = $this->_setFontRegular($page, 9);
     $this->y -= 11;
     $page->drawText(Mage::helper('firegento_pdf')->__('Pos'), $this->margin['left'] + 3, $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('No.'), $this->margin['left'] + 25, $this->y, $this->encoding);
     $page->drawText(Mage::helper('firegento_pdf')->__('Description'), $this->margin['left'] + 130, $this->y, $this->encoding);
     $columns = array();
     $columns['price'] = array('label' => Mage::helper('firegento_pdf')->__('Price'), '_width' => 60);
     $columns['price_incl_tax'] = array('label' => Mage::helper('firegento_pdf')->__('Price (incl. tax)'), '_width' => 60);
     $columns['qty'] = array('label' => Mage::helper('firegento_pdf')->__('Qty'), '_width' => 40);
     $columns['tax'] = array('label' => Mage::helper('firegento_pdf')->__('Tax'), '_width' => 50);
     $columns['tax_rate'] = array('label' => Mage::helper('firegento_pdf')->__('Tax rate'), '_width' => 50);
     $columns['subtotal'] = array('label' => Mage::helper('firegento_pdf')->__('Total'), '_width' => 50);
     $columns['subtotal_incl_tax'] = array('label' => Mage::helper('firegento_pdf')->__('Total (incl. tax)'), '_width' => 70);
     // draw price, tax, and subtotal in specified order
     $columnsOrder = explode(',', Mage::getStoreConfig('sales_pdf/invoice/item_price_column_order'));
     // draw starting from right
     $columnsOrder = array_reverse($columnsOrder);
     $columnOffset = 0;
     foreach ($columnsOrder as $columnName) {
         $columnName = trim($columnName);
         if (array_key_exists($columnName, $columns)) {
             $column = $columns[$columnName];
             $labelWidth = $this->widthForStringUsingFontSize($column['label'], $font, 9);
             $page->drawText($column['label'], $this->margin['right'] - $columnOffset - $labelWidth, $this->y, $this->encoding);
             $columnOffset += $column['_width'];
         }
     }
 }
开发者ID:brentwpeterson,项目名称:firegento-pdf,代码行数:42,代码来源:Default.php


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