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


PHP Zend_Pdf_Style::setFillColor方法代码示例

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


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

示例1: process

 public function process()
 {
     $configuracao = Doctrine::getTable('Configuracao')->find(1);
     $this->document->pages[] = $page = $this->document->newPage(\Zend_Pdf_Page::SIZE_A4);
     //monta o cabecalho
     $color = array();
     $color["black"] = new Zend_Pdf_Color_Html("#000000");
     $fontTitle = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
     $size = 12;
     $styleTitle = new Zend_Pdf_Style();
     $styleTitle->setFont($fontTitle, $size);
     $styleTitle->setFillColor($color["black"]);
     $page->setStyle($styleTitle);
     $page->drawText($configuracao->instituicao, Documento::DOCUMENT_LEFT, Documento::DOCUMENT_TOP, 'UTF-8');
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $style = new Zend_Pdf_Style();
     $style->setFont($font, $size);
     $style->setFillColor($color["black"]);
     $page->setStyle($style);
     $text = wordwrap($this->text, 95, "\n", false);
     $token = strtok($text, "\n");
     $y = 665;
     while ($token != false) {
         if ($y < 100) {
             $this->document->pages[] = $page = $this->document->newPage(Zend_Pdf_Page::SIZE_A4);
             $page->setStyle($style);
             $y = 665;
         } else {
             $y -= 15;
         }
         $page->drawText($token, 60, $y, 'UTF-8');
         $token = strtok("\n");
     }
 }
开发者ID:kidh0,项目名称:TCControl,代码行数:34,代码来源:AlunosMatriculadosDoc.class.php

示例2: setStyle

 public function setStyle()
 {
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
     $style->setFillColor(new Zend_Pdf_Color_Html('#333333'));
     $style->setLineColor(new Zend_Pdf_Color_Html('#990033'));
     $style->setLineWidth(1);
     $this->_page->setStyle($style);
 }
开发者ID:nhochong,项目名称:qlkh-sgu,代码行数:9,代码来源:Page.php

示例3: catch

            // force complete file rewriting (instead of updating)
            $argv[2] = $argv[1];
        }
    } else {
        // Throw an exception if it's not the "Can't open file" exception
        throw $e;
    }
}

//------------------------------------------------------------------------------------
// Reverse page order
$pdf->pages = array_reverse($pdf->pages);

// Create new Style
$style = new Zend_Pdf_Style();
$style->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0.9));
$style->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
$style->setLineWidth(3);
$style->setLineDashingPattern(array(3, 2, 3, 4), 1.6);
$style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 32);

try {
    // Create new image object
    require_once 'Zend/Pdf/Image.php';
    $stampImage = Zend_Pdf_Image::imageWithPath(__DIR__ . '/stamp.jpg');
} catch (Zend_Pdf_Exception $e) {
    // Example of operating with image loading exceptions.
    if ($e->getMessage() != 'Image extension is not installed.' &&
        $e->getMessage() != 'JPG support is not configured properly.') {
        throw $e;
    }
开发者ID:necrogami,项目名称:zf2,代码行数:31,代码来源:demo.php

示例4: write

 /**
  * Draws the cell to the PDF page.
  * 
  * This function will parse the internal $_text field and draw the cell to the PDF page.
  */
 public function write()
 {
     if (!$this->_page instanceof Zend_Pdf_Page) {
         throw new Zend_Pdf_Exception("The PDF page that the cell is attempting to write to is not a valid page.");
     }
     if (!$this->_font instanceof Zend_Pdf_Resource_Font) {
         throw new Zend_Pdf_Exception('No font has been set');
     }
     if ($this->isAutoHeight()) {
         $this->_height = $this->_autoHeight;
     }
     if ($this->isAutoWidth()) {
         $this->_width = $this->_autoWidth;
     }
     //positions of the cell's box
     //initalize the diminsions to defaults
     $top = $this->_y;
     $left = $this->_x;
     $right = $left + $this->getWidth();
     $bottom = $top + $this->getHeight();
     if ($this->_position & Zend_Pdf_Cell::POSITION_BOTTOM) {
         $top = $this->getHeight();
         $bottom = $top + $this->getHeight();
     }
     if ($this->_position & Zend_Pdf_Cell::POSITION_CENTER_X) {
         $left = $this->_page->getWidth() / 2 - $this->getWidth() / 2 + $this->_x;
         $right = $left + $this->getWidth();
     }
     if ($this->_position & Zend_Pdf_Cell::POSITION_CENTER_Y) {
         $top = $this->_page->getHeight() / 2 + $this->getHeight() / 2 - $this->_y;
         $bottom = $top - $this->getHeight();
     }
     if ($this->_position & Zend_Pdf_Cell::POSITION_TOP) {
         $top = $this->_page->getHeight();
         $bottom = $top + $this->getHeight();
     }
     if ($this->_position & Zend_Pdf_Cell::POSITION_RIGHT) {
         $left = $this->_page->getWidth() - $this->getWidth();
         $right = $left + $this->getWidth();
     }
     $currentY = $top;
     //save the page's font so we can put it back after writing the cell
     $pageFont = $this->_page->getFont();
     $fontSize = $this->_page->getFontSize();
     //restore old size and font
     $this->_page->setFont($pageFont, $fontSize);
     //draw the border
     if ($this->_border['size'] > 0) {
         $style = new Zend_Pdf_Style();
         $style->setLineColor($this->getBorderColor());
         $style->setFillColor(new Zend_Pdf_Color_RGB(255, 255, 255));
         $style->setLineDashingPattern($this->getBorderPattern());
         $this->_page->setStyle($style);
         $this->_page->drawRectangle($right, $top, $left, $bottom);
         $style->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
         $this->_page->setStyle($style);
     }
     //draw every section of every page.
     for ($i = 0; $i < count($this->_text); $i++) {
         $currentX = 0;
         switch ($this->_text[$i]['alignment']) {
             case Zend_Pdf_Cell::ALIGN_RIGHT:
                 $currentX = $right - $this->_text[$i]['width'];
                 break;
             case Zend_Pdf_Cell::ALIGN_CENTER:
                 $currentX = ($right - $left) / 2 + $left - $this->_text[$i]['width'] / 2;
                 break;
             case Zend_Pdf_Cell::ALIGN_JUSTIFY:
                 //@todo
                 break;
             default:
                 $currentX = $left;
                 break;
         }
         //add the offset
         $currentX += $this->_text[$i]['x'];
         $currentY -= $this->_text[$i]['height'];
         //count() - 4 because of the 4 properties to this text.
         for ($j = 0; $j < count($this->_text[$i]) - 4; $j++) {
             $this->_page->setFont($this->_text[$i][$j]['font'], $this->_text[$i][$j]['fontSize']);
             $this->_page->drawText($this->_text[$i][$j]['text'], $currentX, $currentY, $this->_text[$i][$j]['encoding']);
             $currentX += $this->_text[$i][$j]['width'];
         }
     }
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:90,代码来源:Cell.php

示例5: foreach

} else {
    foreach ($pdf->pages as $num => $obj) {
        $obj->setStyle($bulletin_style);
        $obj->drawRectangle(30, 32, 150, 20);
        $obj->setFillColor($black);
        $obj->drawText($stamp, 32, 24);
        // stamp
        $pdf->pages[$num] = $obj;
        // save
    }
}
// 5a. note on the time exception
if ($display_name == "A-Note-on-the-Time") {
    $style = new Zend_Pdf_Style();
    $style->setFont(Zend_Pdf_Font::fontWithPath($note_font_path), $note_font_size);
    $style->setFillColor($white);
    $boxes = array();
    $stampText = date('Y M d g:i A', $now);
    $date1 = "2011-02-18 3:34";
    // the time of writing
    $date2 = date('Y-M-d g:i', $now);
    $daylightSaving = date('I');
    $diff = abs(strtotime($date2) - strtotime($date1));
    $days = floor($diff / (60 * 60 * 24));
    $hours = floor(($diff - $days * 60 * 60 * 24) / (60 * 60));
    $minutes = floor(($diff - $days * 60 * 60 * 24 - $hours * 60 * 60) / 60);
    $hours = $hours + $daylightSaving;
    $stampTextD = $days . " days, " . $hours . " hours, " . $minutes . " minutes.";
    // 2d array -- page, x, y, w, h, text
    $boxes = array(array(p => 2, x => 89, y => 602, w => 114, h => 15, t => $stampText), array(p => 4, x => 174, y => 482, w => 114, h => 15, t => $stampText), array(p => 5, x => 169, y => 617, w => 114, h => 15, t => $stampText), array(p => 6, x => 51, y => 362, w => 114, h => 15, t => $stampText), array(p => 6, x => 120, y => 77, w => 152, h => 15, t => $stampTextD));
    foreach ($boxes as $b) {
开发者ID:O-R-G,项目名称:servinglibrary.org,代码行数:31,代码来源:download.php

示例6: stamp

 /**
  *  method to stamp each pdf page (add a banner with timestamp user real name and  confidentiality level)
  *  @param  void
  *  @return void
  */
 public function stamp($values)
 {
     // Prepare stamp
     if ($values != null) {
         $first = true;
         foreach ($values as $value) {
             if ($first) {
                 $sep = '';
                 $first = false;
             } else {
                 $sep = ', ';
             }
             $valueTxt = $sep . $value->getName();
         }
     } else {
         $valueTxt = '';
     }
     $text = "Downloaded on " . date("d M Y H:i", $_SERVER['REQUEST_TIME']) . " by " . $this->user->getRealName() . " " . $valueTxt;
     $stamp = $text . " // " . $text;
     // Text and box style
     $style = new Zend_Pdf_Style();
     $style->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 10);
     $style->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
     $style->setLineColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
     //get pdf watermarking level based on number of pages in pdf document.
     $watermarkingLevel = $this->getWatermarkingLevelFromPdfSize();
     // Stamp with adequate watermarking level
     switch ($watermarkingLevel) {
         case self::WATERMARK_EVERYPAGE:
             // Apply it on all pages
             foreach ($this->pdf->pages as $page) {
                 $this->stampOnePage($page, $style, $stamp);
             }
             break;
         case self::WATERMARK_EVERY_TWO_PAGES:
             $count = 0;
             foreach ($this->pdf->pages as $page) {
                 if ($count % 2 == 0) {
                     $this->stampOnePage($page, $style, $stamp);
                 }
                 $count++;
             }
             break;
         case self::WATERMARK_THIRTY_PERCENT_OF_PAGES:
             $pagesToWatermark = $this->getPagesToWatermark(0.3, count($this->pdf->pages));
             foreach ($pagesToWatermark as $pageNo) {
                 $this->stampOnePage($this->pdf->pages[$pageNo], $style, $stamp);
             }
             break;
         case self::WATERMARK_TEN_PERCENT_OF_PAGES:
         default:
             $pagesToWatermark = $this->getPagesToWatermark(0.1, count($this->pdf->pages));
             foreach ($pagesToWatermark as $pageNo) {
                 $this->stampOnePage($this->pdf->pages[$pageNo], $style, $stamp);
             }
             break;
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:63,代码来源:DocmanWatermark_Stamper.class.php

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

示例8: deploy

 public function deploy()
 {
     $this->checkExportRights();
     $this->setRecordsPerPage(0);
     parent::deploy();
     $width = 0;
     $colors = array('title' => '#000000', 'subtitle' => '#111111', 'footer' => '#111111', 'header' => '#AAAAAA', 'row1' => '#EEEEEE', 'row2' => '#FFFFFF', 'sqlexp' => '#BBBBBB', 'lines' => '#111111', 'hrow' => '#E4E4F6', 'text' => '#000000', 'filters' => '#F9EDD2', 'filtersBox' => '#DEDEDE');
     $this->_deploy['colors'] = array_merge($colors, (array) $this->_deploy['colors']);
     $la = '';
     if (!isset($this->_deploy['save'])) {
         $this->_deploy['save'] = false;
     }
     if (!isset($this->_deploy['download'])) {
         $this->_deploy['download'] = false;
     }
     if ($this->_deploy['save'] != 1 && $this->_deploy['download'] != 1) {
         throw new Exception('Nothing to do. Please specify download&&|save options');
     }
     if (empty($this->_deploy['name'])) {
         $this->_deploy['name'] = date('H_m_d_H_i_s');
     }
     if (substr($this->_deploy['name'], -4) == '.xls') {
         $this->_deploy['name'] = substr($this->_deploy['name'], 0, -4);
     }
     if (!isset($this->_deploy['noPagination'])) {
         $this->_deploy['noPagination'] = 0;
     }
     $this->_deploy['dir'] = rtrim($this->_deploy['dir'], '/') . '/';
     if (!isset($this->_deploy['dir']) || !is_dir($this->_deploy['dir'])) {
         throw new Bvb_Grid_Exception($this->_deploy['dir'] . ' is not a dir');
     }
     if (!is_writable($this->_deploy['dir'])) {
         throw new Bvb_Grid_Exception($this->_deploy['dir'] . ' is not writable');
     }
     $larg = self::calculateCellSize();
     $lengthTotal = array_sum($larg);
     $cellFontSize = 8;
     //set font
     $titulos = parent::_buildTitles();
     $sql = parent::_buildSqlExp();
     $grid = parent::_BuildGrid();
     if (!$this->getInfo('hRow,field')) {
         $this->_info['hRow']['field'] = '';
     }
     if (strtoupper($this->_deploy['orientation']) == 'LANDSCAPE' && strtoupper($this->_deploy['size']) == 'A4') {
         $totalPaginas = ceil(count($grid) / 26);
     } elseif (strtoupper($this->_deploy['orientation']) == 'LANDSCAPE' && strtoupper($this->_deploy['size']) == 'LETTER') {
         $totalPaginas = ceil(count($grid) / 27);
     } else {
         $totalPaginas = ceil(count($grid) / 37);
     }
     if ($totalPaginas < 1) {
         $totalPaginas = 1;
     }
     $pdf = new Zend_Pdf();
     // Create new Style
     $style = new Zend_Pdf_Style();
     $style->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['lines']));
     $topo = new Zend_Pdf_Style();
     $topo->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['header']));
     $td = new Zend_Pdf_Style();
     $td->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['row2']));
     $styleFilters = new Zend_Pdf_Style();
     $styleFilters->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['filters']));
     $styleFiltersBox = new Zend_Pdf_Style();
     $styleFiltersBox->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['filtersBox']));
     $td2 = new Zend_Pdf_Style();
     $td2->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['row1']));
     $hRowStyle = new Zend_Pdf_Style();
     $hRowStyle->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['hrow']));
     $styleSql = new Zend_Pdf_Style();
     $styleSql->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['sqlexp']));
     $styleText = new Zend_Pdf_Style();
     $styleText->setFillColor(new Zend_Pdf_Color_Html($this->_deploy['colors']['text']));
     // Add new page to the document
     if (strtoupper($this->_deploy['size'] = 'LETTER') && strtoupper($this->_deploy['orientation']) == 'LANDSCAPE') {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE);
     } elseif (strtoupper($this->_deploy['size'] = 'LETTER') && strtoupper($this->_deploy['orientation']) != 'LANDSCAPE') {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER);
     } elseif (strtoupper($this->_deploy['size'] != 'A4') && strtoupper($this->_deploy['orientation']) == 'LANDSCAPE') {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
     } else {
         $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     }
     $page->setStyle($style);
     $pdf->pages[] = $page;
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     $page->setFont($font, 14);
     //$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     if (file_exists($this->_deploy['logo'])) {
         $image = Zend_Pdf_Image::imageWithPath($this->_deploy['logo']);
         list($width, $height, $type, $attr) = getimagesize($this->_deploy['logo']);
         $page->drawImage($image, 40, $page->getHeight() - $height - 40, 40 + $width, $page->getHeight() - 40);
     }
     $page->drawText($this->__($this->_deploy['title']), $width + 70, $page->getHeight() - 70, $this->getCharEncoding());
     $page->setFont($font, $cellFontSize);
     $page->drawText($this->__($this->_deploy['subtitle']), $width + 70, $page->getHeight() - 80, $this->getCharEncoding());
     //Iniciar a contagem de páginas
     $pagina = 1;
     $page->drawText($this->_deploy['footer'], 40, 40, $this->getCharEncoding());
//.........这里部分代码省略.........
开发者ID:robjacoby,项目名称:xlr8u,代码行数:101,代码来源:Pdf.php

示例9: __construct

 public function __construct($param1, $param2 = null, $param3 = null)
 {
     parent::__construct($param1, $param2, $param3);
     $style = new Zend_Pdf_Style();
     $style->setLineColor(new Zend_Pdf_Color_Html("#000000"));
     $style->setFillColor(new Zend_Pdf_Color_Html("#000000"));
     $style->setLineWidth(0.5);
     $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
     $style->setFont($font, 10);
     $style->setLineDashingPattern(Zend_Pdf_Page::LINE_DASHING_SOLID);
     $this->_defaultStyle = $style;
     $this->setStyle($style);
 }
开发者ID:uglide,项目名称:zfcore-transition,代码行数:13,代码来源:Page.php

示例10: getPdf

 public function getPdf($data)
 {
     $this->_currentPage = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
     $style = new Zend_Pdf_Style();
     $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
     $style->setFont($fontH, 12);
     $color = Zend_Pdf_Color_Html::color('black');
     $style->setFillColor($color);
     $linkStyle = new Zend_Pdf_Style();
     $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
     $linkStyle->setFont($fontH, 10);
     $color = Zend_Pdf_Color_Html::color('blue');
     $linkStyle->setFillColor($color);
     $linkStyle->setLineColor($color);
     $this->_initCoordinates();
     $this->addImage(Mage::getDesign()->getSkinUrl('images/logo_email.gif', array('_area' => 'frontend')), 30);
     $this->addNewLine(4);
     $helloStyle = new Zend_Pdf_Style();
     $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
     $helloStyle->setFont($fontH, 14);
     $color = Zend_Pdf_Color_Html::color('black');
     $helloStyle->setFillColor($color);
     $this->addText('Hello, ' . $data->getData('email-to') . "!", $helloStyle);
     $this->addNewLine(3);
     $this->addText('You have received a ' . $data->getAmount() . ' Gift Card from ', $style);
     $fromStyle = new Zend_Pdf_Style();
     $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
     $fromStyle->setFont($fontH, 10);
     $this->addText($data->getData('email-from'), $fromStyle);
     $this->addText("! ", $style);
     $store = Mage::getModel('core/store')->load($data->getStoreId());
     $this->addText('This card may be redeemed on ' . $store->getFrontendName() . ' website. Happy shopping!', $style);
     $this->addNewLine(1, $style->getFontSize());
     $this->addImage($data->getPicture(), 400, $this->getLineLimit());
     $this->addNewLine(5);
     $subStyle = new Zend_Pdf_Style();
     $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
     $subStyle->setFont($fontH, 13);
     $color = Zend_Pdf_Color_Html::color('gray');
     $subStyle->setFillColor($color);
     $this->addText('to: ' . $data->getData('email-to'), $subStyle);
     $this->addNewLine(1, $subStyle->getFontSize());
     $this->addText('from: ' . $data->getData('email-from'), $subStyle);
     $this->addNewLine(1, $subStyle->getFontSize());
     $this->addText("message: " . $data->getData('email-message'), $subStyle);
     $this->addNewLine(1, $subStyle->getFontSize());
     $this->addText('gift card value:' . $data->getAmount(), $subStyle);
     $this->addNewLine(1, $subStyle->getFontSize());
     $this->addText('gift card claim code:' . $data->getCode(), $subStyle);
     $this->addNewLine(1, $subStyle->getFontSize());
     $this->addNewLine(5);
     $subStyle = new Zend_Pdf_Style();
     $fontH = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
     $subStyle->setFont($fontH, 9);
     $color = Zend_Pdf_Color_Html::color('black');
     $subStyle->setFillColor($color);
     $this->addText('To redeem and use you gift card: ', $subStyle);
     $this->addNewLine(1, $subStyle->getFontSize());
     $this->addText('    1. Create an account and login into ' . $store->getUrl() . ".", $subStyle);
     $this->addNewLine(1, $subStyle->getFontSize());
     $this->addText('    2. Redeem the card in My Gift Cards page of My Account section.', $subStyle);
     $this->addNewLine(1, $subStyle->getFontSize());
     $this->addText('    3. Alternatively, you can redeem the card on My Cart page before proceeding to checkout.', $subStyle);
     $this->addNewLine(2, $subStyle->getFontSize());
     $this->addText('If you have any questions please contact us at ' . Mage::getStoreConfig('trans_email/ident_support/email'), $subStyle);
     $phone = $data->getData('store-phone');
     if (isset($phone)) {
         $this->addText(' or call us at ' . $phone . " Monday - Friday, 8am - 5pm PST.", $subStyle);
     }
     $this->_currentPdf = new Zend_Pdf();
     $this->_currentPdf->pages[] = $this->_currentPage;
     $this->clearTempFiles();
     return $this->_currentPdf->render();
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:74,代码来源:Pdf.php

示例11:

 //         ->drawText($kh, 50,500 + $page, $charEncoding = 'UTF-8');
 //         $page = $page + 20;
 //     }
 $page1->setStyle($style)->drawText('DAI HOC BACH KHOA TP.HO CHI MINH', 180, 800, $charEncoding = 'UTF-8');
 // define image resource
 $image = Zend_Pdf_Image::imageWithPath('./public/image/logo1.png');
 // write image to page
 $page1->drawImage($image, 240, 668, 360, 790);
 $diaChi = "Dia Chi: 268 Lý Thường Kiệt, Phường 9, Quận 10, TP. Hồ Chí Minh";
 $sdt = "SDT: 08 3568256";
 $page1->setStyle($style)->drawText($diaChi, 50, 650, $charEncoding = 'UTF-8');
 $page1->setStyle($style)->drawText($sdt, 50, 630, $charEncoding = 'UTF-8');
 $title = "THONG TIN DON XUAT";
 // Create new Style
 $styleTitle = new Zend_Pdf_Style();
 $styleTitle->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0));
 $styleTitle->setLineColor(new Zend_Pdf_Color_GrayScale(0.2));
 $styleTitle->setLineWidth(3);
 $styleTitle->setLineDashingPattern(array(3, 2, 3, 4), 1.6);
 $fontTitle = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
 $styleTitle->setFont($fontTitle, 30);
 $page1->setStyle($styleTitle)->drawText($title, 130, 600, $charEncoding = 'UTF-8');
 // add footer text
 $page1->drawLine(80, 25, $page2->getWidth() - 10, 25);
 $page1->drawImage($image, 20, 10, $image->getPixelWidth(), $image->getPixelHeight());
 $page1->setStyle($style)->drawText('Copyright @HCMUT. All rights reserved.', 200, 10);
 $page1->drawLine(40, 580, $page2->getWidth() - 10, 580);
 // 25 --> 580
 // Thông tin khach hang, Get thông tin theo mã khách hàng. Đơn xuất->Mã Đơn Hàng-> Mã Khách hàng
 $postMaKH = 1234;
 // Dữ liệu giả.
开发者ID:LongNguyen-51101909,项目名称:Zend1Example,代码行数:31,代码来源:data.php

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

示例13: drawTable

 /**
  * Draw table or part of table by coordinates with or without header
  *
  * @param array[][] $table Table values
  * @param int $x x coordinate
  * @param int $y y coordinate
  * @param int $width Table width
  * @param int $max_y Minimal y coordinate
  * @param array[] $header Table header
  * @param int $start_row start row of table
  *
  * @return int End row
  *
  * @api
  */
 function drawTable($table, $x, $y, $width, $max_y = 0, $header = NULL, $start_row = 0, $params = false, $note = '')
 {
     if (!$table) {
         return NULL;
     }
     if ($start_row > count($table) - 1) {
         if ($this->currentPosition > $y - $this->MARGIN['bottom']) {
             $this->currentPosition = $y - $this->MARGIN['bottom'];
         }
         return NULL;
     }
     $max_widths = $this->getTableColumnsMaxWidths($table, $params);
     $avg_widths = $this->getTableColumnsAverageWidths($table, $params);
     //	parent::drawText(implode(',',$max_widths), $this -> MARGIN['left'], $this -> MARGIN['bottom'], 'UTF-8');
     //вычисляем ширину столбцов, в зависимости от того, какую таблицу рисуем выбираем нужную формулу
     if ($params) {
         $awidth = array_sum($max_widths) - 0;
     } else {
         $awidth = array_sum($avg_widths) - $avg_widths[0] - 5;
         $widths = array($max_widths[0]);
     }
     // Подгоняем ширину под заданную, через процентные соотношения
     foreach ($avg_widths as $i => $a_w) {
         if ($params) {
             $widths[] = $a_w / $awidth * $width;
         } elseif ($i != 0) {
             $widths[] = $a_w / $awidth * ($width - $widths[0] - 10);
         }
     }
     // запомним наш $x  и текущий $y
     $coords = array($x, $y);
     // write header ( if exists )
     if ($header) {
         //создаем сностки для таблици с параметрами. В зависимости от количества столбцов и длинны названия параметра, заменяем его и записываем в сноски
         $snoski = '';
         $s_number = 1;
         $widthSnoski = $width;
         $this->pageFormat == 'A4' ? $countChar = 30 : ($countChar = 10);
         foreach ($header as $i => $column) {
             if (count($header) > 7 && strlen($column) >= $countChar && $i != 0 || $column == 'Типоразмер') {
                 if ($widthSnoski < $this->widthForStringUsingFontsize($s_number . '* - ' . $column . '; ', Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatSnoski) + $this->widthForStringUsingFontsize($snoski, Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatSnoski)) {
                     $snoski .= chr('0x0D') . chr('0x0A');
                     $widthSnoski *= 2;
                 }
                 $snoski .= $s_number . '* - ' . $column . '; ';
                 $header[$i] = $s_number . '*';
                 $s_number++;
             } elseif ($this->pageFormat == 'A5') {
                 $header[$i] = str_replace('(', chr('0x0D') . chr('0x0A') . '(', $column);
             }
         }
         $snoski .= ' ' . $note;
         $this->saveGS();
         $style = new Zend_Pdf_Style();
         $style->setFillColor(new Zend_Pdf_Color_Html("white"));
         $style->setFont(Model_Static_Fonts::get("Arial Narrow"), $this->fontSizeFormatHeader);
         // Bold
         $this->setStyle($style);
         // calculate height of header
         $height = 0;
         foreach ($header as $i => $column) {
             $style->setLineWidth($widths[$i]);
             $height = max($height, $this->getTextBlockHeight(trim($column), $style, 0, true));
         }
         // if we can't write 2 line - exit
         if ($y - $height - $max_y < 16) {
             $this->restoreGS();
             return 0;
         }
         // else - draw header background
         $this->drawHorizontalLine($coords[0] + 5, $coords[0] + $width, $this->pageFormat == 'A4' ? $y - $height / 2 + 5.5 : $y - $height / 2 + 3.5, $height, new Zend_Pdf_Color_Html("#0095da"));
         // here - write header
         //
         foreach ($header as $i => $col) {
             $style->setLineWidth($widths[$i]);
             $width_text = $this->widthForStringUsingFontsize($col, $style->getFont(), $style->getFontSize());
             if ($widths[$i] > $width_text && $i != 0) {
                 $iLeft = $x + ($widths[$i] - $width_text) / 2;
             } else {
                 $iLeft = $x + 8;
             }
             $y = min($y, $this->drawTextBlock(str_replace(array(''), array(''), trim($col)), $iLeft + 1 * ($i == 0), $coords[1] - 3, $style, 0, true));
             $x += $widths[$i];
         }
         $this->restoreGS();
//.........这里部分代码省略.........
开发者ID:Alpha-Hydro,项目名称:alpha-hydro-antares,代码行数:101,代码来源:PdfPage.php


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