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


PHP Zend_Pdf_Page::saveGS方法代码示例

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


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

示例1: addPieceNumber

 /**
  * Add Piece Number
  *
  * @param int $pieceNumber
  * @param int $piecesTotal
  * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder
  * @throws InvalidArgumentException
  * @throws Zend_Pdf_Exception
  */
 public function addPieceNumber($pieceNumber, $piecesTotal)
 {
     $this->_page->saveGS();
     if (!$pieceNumber || !$piecesTotal) {
         throw new InvalidArgumentException(Mage::helper('usa')->__('Piece number information is missing'));
     }
     $this->_page->setFont($this->_fontNormal, 6);
     $this->_page->drawText('Piece:', $this->_x(256), $this->_y(224));
     $this->_page->setFont($this->_fontBold, 11);
     $this->_page->drawText($pieceNumber . '/' . $piecesTotal, $this->_x(256), $this->_y(234));
     $this->_page->restoreGS();
     return $this;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:22,代码来源:PageBuilder.php

示例2: testPageCloning

 public function testPageCloning()
 {
     $pdf = Zend_Pdf::load(dirname(__FILE__) . '/_files/pdfarchiving.pdf');
     $srcPageCount = count($pdf->pages);
     try {
         $newPage = clone reset($pdf->pages);
     } catch (Zend_Pdf_Exception $e) {
         if (strpos($e->getMessage(), 'Cloning Zend_Pdf_Page object using \'clone\' keyword is not supported.') !== 0) {
             throw $e;
         }
         // Exception is thrown
     }
     $outputPageSet = array();
     foreach ($pdf->pages as $srcPage) {
         $page = new Zend_Pdf_Page($srcPage);
         $outputPageSet[] = $srcPage;
         $outputPageSet[] = $page;
         $page->saveGS();
         // Create new Style
         $page->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0.9))->setLineColor(new Zend_Pdf_Color_GrayScale(0.2))->setLineWidth(3)->setLineDashingPattern(array(3, 2, 3, 4), 1.6)->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 32);
         $page->rotate(0, 0, M_PI_2 / 3);
         $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)
     $pdf->pages = $outputPageSet;
     $pdf->save(dirname(__FILE__) . '/_files/output.pdf');
     unset($pdf);
     $pdf1 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output.pdf');
     $this->assertTrue($pdf1 instanceof Zend_Pdf);
     $this->assertEquals($srcPageCount * 2, count($pdf1->pages));
     unset($pdf1);
     unlink(dirname(__FILE__) . '/_files/output.pdf');
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:34,代码来源:ProcessingTest.php

示例3: array

// 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 figures in modified coordination system -----------------------------------

// Coordination system movement
$page2->saveGS();
$page2->translate(60, 250); // Shift coordination system

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

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

// Draw sectors
$page2->drawCircle(140, 25, 25, 2*M_PI/3, -M_PI/6)
开发者ID:necrogami,项目名称:zf2,代码行数:31,代码来源:demo.php

示例4: _drawItemLabel

 /**
  * Draw one label section for one item on the PDF document.
  *
  * @param int $column Horizontal index on the current page
  * @param int $row Vertical index on the current page
  * @param Item $item The item to report on
  */
 private function _drawItemLabel(Zend_Pdf_Page $page, $column, $row, $item)
 {
     // Start at the bottom left corner and count over for columns and down
     // for rows.
     $originX = self::MARGIN_LEFT + $column * (self::LABEL_WIDTH + self::HORIZONTAL_SPACING);
     $originY = self::PAGE_HEIGHT - self::MARGIN_TOP - ($row + 1) * (self::LABEL_HEIGHT + self::VERTICAL_SPACING);
     $page->saveGS();
     // Clip on label boundaries to stop text from running over.
     $page->clipRectangle($originX, $originY, $originX + self::LABEL_WIDTH, $originY + self::LABEL_HEIGHT);
     $image = $this->_getQrCode($this->_baseUrl . '/items/show/' . $item->id);
     $page->drawImage($image, $originX, $originY, $originX + self::LABEL_HEIGHT, $originY + self::LABEL_HEIGHT);
     $titles = $item->getElementTexts('Dublin Core', 'Title');
     if (count($titles) > 0) {
         $textOriginX = $originX + self::LABEL_HEIGHT;
         $textOriginY = $originY + 0.8 * self::LABEL_HEIGHT;
         $cleanTitle = strip_tags(htmlspecialchars_decode($titles[0]->text));
         $this->_drawWrappedText($page, $cleanTitle, $textOriginX, $textOriginY, self::LABEL_WIDTH - (self::LABEL_HEIGHT + 4));
     }
     // Remove clipping rectangle
     $page->restoreGS();
     // Release objects after use to keep memory usage down
     release_object($item);
 }
开发者ID:ungc0,项目名称:comp356-mac15,代码行数:30,代码来源:PdfQrCode.php


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