本文整理汇总了PHP中Zend_Pdf_Resource类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf_Resource类的具体用法?PHP Zend_Pdf_Resource怎么用?PHP Zend_Pdf_Resource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Pdf_Resource类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _attachResource
/**
* Attach resource to the canvas
*
* Method returns a name of the resource which can be used
* as a resource reference within drawing instructions stream
* Allowed types: 'ExtGState', 'ColorSpace', 'Pattern', 'Shading',
* 'XObject', 'Font', 'Properties'
*
* @param string $type
* @param Zend_Pdf_Resource $resource
* @return string
*/
protected function _attachResource($type, Zend_Pdf_Resource $resource)
{
// Check, that resource is already attached to resource set.
$resObject = $resource->getResource();
foreach ($this->_resources[$type] as $resName => $collectedResObject) {
if ($collectedResObject === $resObject) {
return $resName;
}
}
$idCounter = 1;
do {
$newResName = $type[0] . $idCounter++;
} while (isset($this->_resources[$type][$newResName]));
$this->_resources[$type][$newResName] = $resObject;
return $newResName;
}
示例2: _attachResource
/**
* Attach resource to the page
*
* @param string $type
* @param Zend_Pdf_Resource $resource
* @return string
*/
protected function _attachResource($type, Zend_Pdf_Resource $resource)
{
// Check that Resources dictionary contains appropriate resource set
if ($this->_pageDictionary->Resources->{$type} === null) {
$this->_pageDictionary->Resources->touch();
$this->_pageDictionary->Resources->{$type} = new Zend_Pdf_Element_Dictionary();
} else {
$this->_pageDictionary->Resources->{$type}->touch();
}
// Check, that resource is already attached to resource set.
$resObject = $resource->getResource();
foreach ($this->_pageDictionary->Resources->{$type}->getKeys() as $ResID) {
if ($this->_pageDictionary->Resources->{$type}->{$ResID} === $resObject) {
return $ResID;
}
}
$idCounter = 1;
do {
$newResName = $type[0] . $idCounter++;
} while ($this->_pageDictionary->Resources->{$type}->{$newResName} !== null);
$this->_pageDictionary->Resources->{$type}->{$newResName} = $resObject;
$this->_objFactory->attach($resource->getFactory());
return $newResName;
}
示例3: __construct
/**
* Object constructor.
*/
public function __construct()
{
parent::__construct('');
$this->_resource->dictionary->Type = new Zend_Pdf_Element_Name('XObject');
$this->_resource->dictionary->Subtype = new Zend_Pdf_Element_Name('Image');
}
示例4: __construct
/**
* Object constructor.
*
* @param Zend_Pdf_Element_Object_Stream|string $contentStreamObject
* @throws Zend_Pdf_Exception
*/
public function __construct($contentStreamObject = '')
{
if ($contentStreamObject !== null && !$contentStreamObject instanceof Zend_Pdf_Element_Object_Stream && !is_string($contentStreamObject)) {
require_once PHP_LIBRARY_PATH . 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Content stream parameter must be a string or stream object');
}
parent::__construct($contentStreamObject);
}
示例5: __construct
/**
* Object constructor.
*
* @param Zend_Pdf_Element_Object $extGStateObject
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element_Object $extGStateObject = null)
{
if ($extGStateObject == null) {
// Create new Graphics State object
require_once 'Zend/Pdf/ElementFactory.php';
$factory = Zend_Pdf_ElementFactory::createFactory(1);
$gsDictionary = new Zend_Pdf_Element_Dictionary();
$gsDictionary->Type = new Zend_Pdf_Element_Name('ExtGState');
$extGStateObject = $factory->newObject($gsDictionary);
}
if ($extGStateObject->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Graphics state PDF object must be a dictionary');
}
parent::__construct($gsDictionary);
}
示例6: __construct
/**
* Object constructor.
*
*/
public function __construct()
{
parent::__construct(new Zend_Pdf_Element_Dictionary());
$this->_resource->Type = new Zend_Pdf_Element_Name('Font');
}
示例7: __construct
/**
* Object constructor.
*
* The $embeddingOptions parameter allows you to set certain flags related
* to font embedding. You may combine options by OR-ing them together. See
* the EMBED_ constants defined in {@link Zend_Pdf_Font} for the list of
* available options and their descriptions.
*
* @param integer $embeddingOptions (optional) Options for font embedding.
* Only used for certain font types.
*/
public function __construct($embeddingOptions = 0)
{
parent::__construct(new Zend_Pdf_Element_Dictionary());
$this->_resource->Type = new Zend_Pdf_Element_Name('Font');
$this->_embeddingOptions = $embeddingOptions;
}