Exemple #1
0
 public function render(Am_Pdf_Page_Decorator $page, $x, $y)
 {
     if ($font = $this->getProperty('font')) {
         $fontTmp = $page->getFont();
         $fontSizeTmp = $page->getFontSize();
         $page->setFont($font['face'], $font['size']);
     }
     $lineHeight = $page->getFont()->getLineHeight() / 100;
     $lineBegin = $y - $this->getPadding(self::TOP) - $lineHeight;
     $width = $this->getWidth() - $this->getPadding(self::LEFT) - $this->getPadding(self::RIGHT);
     switch ($this->getProperty('align', Am_Pdf_Page_Decorator::ALIGN_LEFT)) {
         case Am_Pdf_Page_Decorator::ALIGN_LEFT:
             $lineEnd = $page->drawTextWithFixedWidth($this->content, $x + 1 + $this->getPadding(self::LEFT), $lineBegin, $width);
             break;
         case Am_Pdf_Page_Decorator::ALIGN_RIGHT:
             $lineEnd = $page->drawTextWithFixedWidth($this->content, $x + $this->getWidth() - 1 - $this->getPadding(self::RIGHT), $lineBegin, $width, 'UTF-8', Am_Pdf_Page_Decorator::ALIGN_RIGHT);
             break;
     }
     $rowHeight = $lineBegin - $lineEnd;
     if ($font) {
         $page->setFont($fontTmp, $fontSizeTmp);
     }
     $shape = $this->getProperty('shape', array('type' => Zend_Pdf_Page::SHAPE_DRAW_STROKE, 'color' => new Zend_Pdf_Color_Html('#cccccc')));
     return array('x' => $x, 'y' => $y, 'width' => $this->getWidth(), 'height' => $rowHeight + $this->getPadding(self::BOTTOM) + $this->getPadding(self::TOP), 'shape' => $shape);
 }
Exemple #2
0
 protected function drawBorder(Am_Pdf_Page_Decorator $page, $x, $y)
 {
     $rowHeight = $page->getFont()->getLineHeight() / 100;
     $shape = $this->getProperty('shape', array('type' => Zend_Pdf_Page::SHAPE_DRAW_STROKE, 'color' => new Zend_Pdf_Color_Html('#cccccc')));
     $page->setLineColor($shape['color']);
     $page->setFillColor($shape['color']);
     $page->drawRectangle($x, $y, $x + $this->getWidth(), $y + $rowHeight + $this->getPadding(self::BOTTOM) + $this->getPadding(self::TOP), $shape['type']);
     $page->setFillColor(new Zend_Pdf_Color_Html('#000000'));
 }