當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Pdf_Page::restoreGS方法代碼示例

本文整理匯總了PHP中Zend_Pdf_Page::restoreGS方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Pdf_Page::restoreGS方法的具體用法?PHP Zend_Pdf_Page::restoreGS怎麽用?PHP Zend_Pdf_Page::restoreGS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Pdf_Page的用法示例。


在下文中一共展示了Zend_Pdf_Page::restoreGS方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: array

$page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1));
$x = array();
$y = array();
for ($count = 0; $count < 8; $count++) {
    $x[] = 80 + 25*cos(3*M_PI_4*$count);
    $y[] = 25 + 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)
      ->drawLine(0, 25, 340, 25);

$page2->restoreGS();


// Coordination system movement, skewing and scaling
$page2->saveGS();
$page2->translate(60, 150)     // Shift coordination system
      ->skew(0, 0, 0, -M_PI/9) // Skew coordination system
      ->scale(0.9, 0.9);       // Scale 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
開發者ID:necrogami,項目名稱:zf2,代碼行數:31,代碼來源:demo.php

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


注:本文中的Zend_Pdf_Page::restoreGS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。