本文整理匯總了PHP中Zend_Pdf_Page::clipRectangle方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Pdf_Page::clipRectangle方法的具體用法?PHP Zend_Pdf_Page::clipRectangle怎麽用?PHP Zend_Pdf_Page::clipRectangle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Pdf_Page
的用法示例。
在下文中一共展示了Zend_Pdf_Page::clipRectangle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _drawItemLabel
/**
* Draw one label section for one item on the PDF document.
*
* @param int $column Horizontal index on the current page
* @param int $row Vertical index on the current page
* @param Item $item The item to report on
*/
private function _drawItemLabel(Zend_Pdf_Page $page, $column, $row, $item)
{
// Start at the bottom left corner and count over for columns and down
// for rows.
$originX = self::MARGIN_LEFT + $column * (self::LABEL_WIDTH + self::HORIZONTAL_SPACING);
$originY = self::PAGE_HEIGHT - self::MARGIN_TOP - ($row + 1) * (self::LABEL_HEIGHT + self::VERTICAL_SPACING);
$page->saveGS();
// Clip on label boundaries to stop text from running over.
$page->clipRectangle($originX, $originY, $originX + self::LABEL_WIDTH, $originY + self::LABEL_HEIGHT);
$image = $this->_getQrCode($this->_baseUrl . '/items/show/' . $item->id);
$page->drawImage($image, $originX, $originY, $originX + self::LABEL_HEIGHT, $originY + self::LABEL_HEIGHT);
$titles = $item->getElementTexts('Dublin Core', 'Title');
if (count($titles) > 0) {
$textOriginX = $originX + self::LABEL_HEIGHT;
$textOriginY = $originY + 0.8 * self::LABEL_HEIGHT;
$cleanTitle = strip_tags(htmlspecialchars_decode($titles[0]->text));
$this->_drawWrappedText($page, $cleanTitle, $textOriginX, $textOriginY, self::LABEL_WIDTH - (self::LABEL_HEIGHT + 4));
}
// Remove clipping rectangle
$page->restoreGS();
// Release objects after use to keep memory usage down
release_object($item);
}