本文整理汇总了PHP中Zend_Pdf_Action::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf_Action::load方法的具体用法?PHP Zend_Pdf_Action::load怎么用?PHP Zend_Pdf_Action::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Pdf_Action
的用法示例。
在下文中一共展示了Zend_Pdf_Action::load方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* Parse resource and return it as an Action or Explicit Destination
*
* $param Zend_Pdf_Element $resource
* @return Zend_Pdf_Destination|
* @throws Zend_Pdf_Exception
*/
public static function load(Zend_Pdf_Element $resource)
{
require_once 'Zend/Pdf/Element.php';
if ($resource->getType() == Zend_Pdf_Element::TYPE_DICTIONARY) {
if (($resource->Type === null || $resource->Type->value == 'Action') && $resource->S !== null) {
// It's a well-formed action, load it
require_once 'Zend/Pdf/Action.php';
return Zend_Pdf_Action::load($resource);
} else {
if ($resource->D !== null) {
// It's a destination
$resource = $resource->D;
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Wrong resource type.');
}
}
}
if ($resource->getType() == Zend_Pdf_Element::TYPE_ARRAY || $resource->getType() == Zend_Pdf_Element::TYPE_NAME || $resource->getType() == Zend_Pdf_Element::TYPE_STRING) {
// Resource is an array, just treat it as an explicit destination array
require_once 'Zend/Pdf/Destination.php';
return Zend_Pdf_Destination::load($resource);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Wrong resource type.');
}
}
示例2: __construct
/**
* Object constructor
*
* @param Zend_Pdf_Element_Dictionary $dictionary
* @param SplObjectStorage $processedActions list of already processed action dictionaries, used to avoid cyclic references
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions)
{
require_once 'Zend/Pdf/Element.php';
if ($dictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('$dictionary mast be a direct or an indirect dictionary object.');
}
$this->_actionDictionary = $dictionary;
if ($dictionary->Next !== null) {
if ($dictionary->Next instanceof Zend_Pdf_Element_Dictionary) {
// Check if dictionary object is not already processed
if (!$processedActions->contains($dictionary->Next)) {
$processedActions->attach($dictionary->Next);
$this->next[] = Zend_Pdf_Action::load($dictionary->Next, $processedActions);
}
} else {
if ($dictionary->Next instanceof Zend_Pdf_Element_Array) {
foreach ($dictionary->Next->items as $chainedActionDictionary) {
// Check if dictionary object is not already processed
if (!$processedActions->contains($chainedActionDictionary)) {
$processedActions->attach($chainedActionDictionary);
$this->next[] = Zend_Pdf_Action::load($chainedActionDictionary, $processedActions);
}
}
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('PDF Action dictionary Next entry must be a dictionary or an array.');
}
}
}
$this->_originalNextList = $this->next;
}
示例3: load
/**
* Parse resource and return it as an Action or Explicit Destination
*
* $param Zend_Pdf_Element $resource
* @return Zend_Pdf_Destination|
* @throws Zend_Pdf_Exception
*/
public static function load(Zend_Pdf_Element $resource)
{
if ($resource->getType() == Zend_Pdf_Element::TYPE_DICTIONARY) {
// Load destination as appropriate action
return Zend_Pdf_Action::load($resource);
} else {
if ($resource->getType() == Zend_Pdf_Element::TYPE_ARRAY || $resource->getType() == Zend_Pdf_Element::TYPE_NAME || $resource->getType() == Zend_Pdf_Element::TYPE_STRING) {
// Resource is an array, just treat it as an explicit destination array
return Zend_Pdf_Destination::load($resource);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Wrong resource type.');
}
}
}
示例4: getTarget
/**
* Get outline target.
*
* @return Zend_Pdf_Target
* @throws Zend_Pdf_Exception
*/
public function getTarget()
{
if ($this->_outlineDictionary->Dest !== null) {
if ($this->_outlineDictionary->A !== null) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline dictionary may contain Dest or A entry, but not both.');
}
require_once 'Zend/Pdf/Destination.php';
return Zend_Pdf_Destination::load($this->_outlineDictionary->Dest);
} else {
if ($this->_outlineDictionary->A !== null) {
require_once 'Zend/Pdf/Action.php';
return Zend_Pdf_Action::load($this->_outlineDictionary->A);
}
}
return null;
}
示例5: getDestination
/**
* Get link annotation destination
*
* @return Zend_Pdf_Target|null
*/
public function getDestination()
{
if ($this->_annotationDictionary->Dest === null && $this->_annotationDictionary->A === null) {
return null;
}
if ($this->_annotationDictionary->Dest !== null) {
#require_once 'Zend/Pdf/Destination.php';
return Zend_Pdf_Destination::load($this->_annotationDictionary->Dest);
} else {
#require_once 'Zend/Pdf/Action.php';
return Zend_Pdf_Action::load($this->_annotationDictionary->A);
}
}
示例6: testActionURILoad2
public function testActionURILoad2()
{
$dictionary = new Zend_Pdf_Element_Dictionary();
$dictionary->Type = new Zend_Pdf_Element_Name('Action');
$dictionary->S = new Zend_Pdf_Element_Name('URI');
try {
$action = Zend_Pdf_Action::load($dictionary);
$this->fail("exception expected");
} catch (Zend_Pdf_Exception $e) {
$this->assertContains('URI action dictionary entry is required', $e->getMessage());
}
}
示例7: getDestination
/**
* Get link annotation destination
*
* @return Zend_Pdf_Target|null
*/
public function getDestination()
{
if ($this->_annotationDictionary->Dest === null && $this->_annotationDictionary->A === null) {
return null;
}
if ($this->_annotationDictionary->Dest !== null) {
return Zend_Pdf_Destination::load($this->_annotationDictionary->Dest);
} else {
return Zend_Pdf_Action::load($this->_annotationDictionary->A);
}
}