本文整理汇总了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;
}
示例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
示例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');
}