本文整理汇总了PHP中Zend_Pdf_Style::setLineDashingPattern方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf_Style::setLineDashingPattern方法的具体用法?PHP Zend_Pdf_Style::setLineDashingPattern怎么用?PHP Zend_Pdf_Style::setLineDashingPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Pdf_Style
的用法示例。
在下文中一共展示了Zend_Pdf_Style::setLineDashingPattern方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'];
}
}
}
示例2: catch
} 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;
}
$stampImage = null;
}
示例3: __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);
}