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


PHP Zend_Pdf_Page::setStyle方法代码示例

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


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

示例1: drawGeneralLayout

 private function drawGeneralLayout()
 {
     $recstyle = new Zend_Pdf_Style();
     $recstyle->setLineWidth(0.5);
     $this->page->setStyle($recstyle);
     $this->page->drawRoundedRectangle($this->coordX(0), $this->coordY(0) - $this->mmToPts(150), $this->coordX(0) + $this->mmToPts(100), $this->coordY(0), $radius = array(15, 15, 15, 15), $fillType = Zend_Pdf_Page::SHAPE_DRAW_STROKE);
     //General GLS-Layout
     //x-achse | y-Achse | Länge | Dicke
     $ControlBar1 = array('x' => 1, 'y' => 2, 'length' => 98, 'thick' => 1, 'horizontal' => true);
     $ControlBar2 = array('x' => 1, 'y' => 15, 'length' => 98, 'thick' => 0.5, 'horizontal' => true);
     $ControlBar3 = array('x' => 1, 'y' => 27.5, 'length' => 98, 'thick' => 0.5, 'horizontal' => true);
     $ControlBar4 = array('x' => 1, 'y' => 56, 'length' => 98, 'thick' => 0.5, 'horizontal' => true);
     $Line1 = array('x' => 1, 'y' => 62.5, 'length' => 98, 'thick' => 0.25, 'horizontal' => true);
     $Line2 = array('x' => 1, 'y' => 90, 'length' => 81.5, 'thick' => 0.25, 'horizontal' => true);
     $Line3 = array('x' => 1, 'y' => 119, 'length' => 81.5, 'thick' => 0.25, 'horizontal' => true);
     $Line4 = array('x' => 1, 'y' => 134.5, 'length' => 98, 'thick' => 0.25, 'horizontal' => true);
     $Line5 = array('x' => 1, 'y' => 62.5, 'length' => 72, 'thick' => 0.25, 'horizontal' => false);
     $Line6 = array('x' => 82.5, 'y' => 62.5, 'length' => 72, 'thick' => 0.25, 'horizontal' => false);
     $Line7 = array('x' => 99, 'y' => 62.5, 'length' => 72, 'thick' => 0.25, 'horizontal' => false);
     $PrimaryCodeBorder1_1 = array('x' => 1, 'y' => 28.5, 'length' => 5, 'thick' => 1, 'horizontal' => true);
     $PrimaryCodeBorder1_2 = array('x' => 1.5, 'y' => 28.5, 'length' => 5, 'thick' => 1, 'horizontal' => false);
     $PrimaryCodeBorder2_1 = array('x' => 1, 'y' => 55, 'length' => 5, 'thick' => 1, 'horizontal' => true);
     $PrimaryCodeBorder2_2 = array('x' => 1.5, 'y' => 50, 'length' => 5, 'thick' => 1, 'horizontal' => false);
     $PrimaryCodeBorder3_1 = array('x' => 22.5, 'y' => 28.5, 'length' => 5, 'thick' => 1, 'horizontal' => true);
     $PrimaryCodeBorder3_2 = array('x' => 27, 'y' => 28.5, 'length' => 5, 'thick' => 1, 'horizontal' => false);
     $PrimaryCodeBorder4_1 = array('x' => 22.5, 'y' => 55, 'length' => 5, 'thick' => 1, 'horizontal' => true);
     $PrimaryCodeBorder4_2 = array('x' => 27, 'y' => 50, 'length' => 5, 'thick' => 1, 'horizontal' => false);
     $LayoutCollection = array($ControlBar1, $ControlBar2, $ControlBar3, $ControlBar4, $Line1, $Line2, $Line3, $Line4, $Line5, $Line6, $Line7, $PrimaryCodeBorder1_1, $PrimaryCodeBorder1_2, $PrimaryCodeBorder2_1, $PrimaryCodeBorder2_2, $PrimaryCodeBorder3_1, $PrimaryCodeBorder3_2, $PrimaryCodeBorder4_1, $PrimaryCodeBorder4_2);
     foreach ($LayoutCollection as $element) {
         // define a style
         $controlLayoutStyle = new Zend_Pdf_Style();
         $controlLayoutStyle->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
         $controlLayoutStyle->setLineColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
         $controlLayoutStyle->setLineWidth($this->mmToPts($element['thick']));
         $this->page->setStyle($controlLayoutStyle);
         if ($element['horizontal']) {
             $this->page->drawLine($this->coordX($this->mmToPts($element['x'])), $this->coordY($this->mmToPts($element['y'])), $this->coordX($this->mmToPts($element['x']) + $this->mmToPts($element['length'])), $this->coordY($this->mmToPts($element['y'])));
         } else {
             $this->page->drawLine($this->coordX($this->mmToPts($element['x'])), $this->coordY($this->mmToPts($element['y'])), $this->coordX($this->mmToPts($element['x'])), $this->coordY($this->mmToPts($element['y']) + $this->mmToPts($element['length'])));
         }
     }
     try {
         // Erstelle ein neues Grafikobjekt
         $imageFile = SERVER_BASE . '/images/Logo_GLS.jpg';
         $stampImage = Zend_Pdf_Image::imageWithPath($imageFile);
     } catch (Zend_Pdf_Exception $e) {
         // Beispiel wie man mit Ladefehlern bei Grafiken umgeht.
         $stampImage = null;
     }
     if ($stampImage != null) {
         $this->page->drawImage($stampImage, $this->coordX(180), $this->coordY(0) - $this->mmToPts(149), $this->coordX($this->mmToPts(99)), $this->coordY($this->mmToPts(150)) + $this->mmToPts(14));
     }
     $this->page->setStyle($this->defaultStyle);
 }
开发者ID:Blackbam1337,项目名称:phpGlsUniboxShippingLabels,代码行数:54,代码来源:Gls_Unibox_Model_Pdf_Abstract.php

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

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


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