本文整理汇总了PHP中Zend_Pdf_Element_Dictionary类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf_Element_Dictionary类的具体用法?PHP Zend_Pdf_Element_Dictionary怎么用?PHP Zend_Pdf_Element_Dictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Pdf_Element_Dictionary类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: dumpAction
/**
* Dump Action and its child actions into PDF structures
*
* Returns dictionary indirect object or reference
*
* @internal
* @param Zend_Pdf_ElementFactory $factory Object factory for newly created indirect objects
* @param SplObjectStorage $processedActions list of already processed actions (used to prevent infinity loop caused by cyclic references)
* @return Zend_Pdf_Element_Object|Zend_Pdf_Element_Reference Dictionary indirect object
*/
public function dumpAction(Zend_Pdf_ElementFactory_Interface $factory, SplObjectStorage $processedActions = null)
{
if ($processedActions === null) {
$processedActions = new SplObjectStorage();
}
if ($processedActions->contains($this)) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Action chain cyclyc reference is detected.');
}
$processedActions->attach($this);
$childListUpdated = false;
if (count($this->_originalNextList) != count($this->next)) {
// If original and current children arrays have different size then children list was updated
$childListUpdated = true;
} else {
if (!(array_keys($this->_originalNextList) === array_keys($this->next))) {
// If original and current children arrays have different keys (with a glance to an order) then children list was updated
$childListUpdated = true;
} else {
foreach ($this->next as $key => $childAction) {
if ($this->_originalNextList[$key] !== $childAction) {
$childListUpdated = true;
break;
}
}
}
}
if ($childListUpdated) {
$this->_actionDictionary->touch();
switch (count($this->next)) {
case 0:
$this->_actionDictionary->Next = null;
break;
case 1:
$child = reset($this->next);
$this->_actionDictionary->Next = $child->dumpAction($factory, $processedActions);
break;
default:
require_once 'Zend/Pdf/Element/Array.php';
$pdfChildArray = new Zend_Pdf_Element_Array();
foreach ($this->next as $child) {
$pdfChildArray->items[] = $child->dumpAction($factory, $processedActions);
}
$this->_actionDictionary->Next = $pdfChildArray;
break;
}
} else {
foreach ($this->next as $child) {
$child->dumpAction($factory, $processedActions);
}
}
if ($this->_actionDictionary instanceof Zend_Pdf_Element_Dictionary) {
// It's a newly created action. Register it within object factory and return indirect object
return $factory->newObject($this->_actionDictionary);
} else {
// It's a loaded object
return $this->_actionDictionary;
}
}
开发者ID:kokx,项目名称:zf-library,代码行数:69,代码来源:Action.php
示例2: _readDictionary
/**
* Read dictionary PDF object
* Also reads trailing '>>' from a pdf stream
*
* @return Zend_Pdf_Element_Dictionary
* @throws Zend_Pdf_Exception
*/
private function _readDictionary()
{
$dictionary = new Zend_Pdf_Element_Dictionary();
while (strlen($nextLexeme = $this->readLexeme()) != 0) {
if ($nextLexeme != '>>') {
$nameStart = $this->offset - strlen($nextLexeme);
$name = $this->readElement($nextLexeme);
$value = $this->readElement();
if (!$name instanceof Zend_Pdf_Element_Name) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Name object expected while dictionary reading. Offset - 0x%X.', $nameStart));
}
$dictionary->add($name, $value);
} else {
return $dictionary;
}
}
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while dictionary reading. Offset - 0x%X. \'>>\' expected.', $this->offset));
}
开发者ID:travisj,项目名称:zf,代码行数:27,代码来源:StringParser.php
示例3: testAdd
public function testAdd()
{
$dictionaryObj = new Zend_Pdf_Element_Dictionary();
$dictionaryObj->add(new Zend_Pdf_Element_Name('Var1'), new Zend_Pdf_Element_Boolean(false));
$dictionaryObj->add(new Zend_Pdf_Element_Name('Var2'), new Zend_Pdf_Element_Numeric(100.426));
$dictionaryObj->add(new Zend_Pdf_Element_Name('Var3'), new Zend_Pdf_Element_Name('MyName'));
$dictionaryObj->add(new Zend_Pdf_Element_Name('Var4'), new Zend_Pdf_Element_String('some text'));
$this->assertEquals($dictionaryObj->toString(), '<</Var1 false /Var2 100.426 /Var3 /MyName /Var4 (some text) >>');
}
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:9,代码来源:DictionaryTest.php
示例4: dump
/**
* Dump object to a string to save within PDF file
*
* $factory parameter defines operation context.
*
* @param Zend_Pdf_ElementFactory $factory
* @return string
*/
public function dump(Zend_Pdf_ElementFactory $factory)
{
$shift = $factory->getEnumerationShift($this->_factory);
// Update stream length
$this->dictionary->Length->value = $this->length();
return $this->_objNum + $shift . " " . $this->_genNum . " obj \n" . $this->dictionary->toString($factory) . "\n" . $this->_value->toString($factory) . "\n" . "endobj\n";
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:15,代码来源:Stream.php
示例5: setText
/**
* Set text to be displayed for the annotation or, if this type of annotation
* does not display text, an alternate description of the annotation’s contents
* in human-readable form.
*
* @param string $text
* @return Zend_Pdf_Annotation
*/
public function setText($text)
{
if ($this->_annotationDictionary->Contents === null) {
$this->_annotationDictionary->touch();
$this->_annotationDictionary->Contents = new Zend_Pdf_Element_String($text);
} else {
$this->_annotationDictionary->Contents->touch();
$this->_annotationDictionary->Contents->value = new Zend_Pdf_Element_String($text);
}
return $this;
}
开发者ID:robeendey,项目名称:ce,代码行数:19,代码来源:Annotation.php
示例6: setText
/**
* Set text to be displayed for the annotation or, if this type of annotation
* does not display text, an alternate description of the annotation’s contents
* in human-readable form.
*
* @param string $text
* @return Zend_Pdf_Annotation
*/
public function setText($text)
{
require_once 'Zend/Pdf/Element/String.php';
if ($this->_annotationDictionary->Contents === null) {
$this->_annotationDictionary->touch();
$this->_annotationDictionary->Contents = new Zend_Pdf_Element_String($text);
} else {
$this->_annotationDictionary->Contents->touch();
$this->_annotationDictionary->Contents->value = new Zend_Pdf_Element_String($text);
}
return $this;
}
开发者ID:andrelsguerra,项目名称:pequiambiental,代码行数:20,代码来源:Annotation.php
示例7: makeClone
/**
* Detach PDF object from the factory (if applicable), clone it and attach to new factory.
*
* @param Zend_Pdf_ElementFactory $factory The factory to attach
* @param array &$processed List of already processed indirect objects, used to avoid objects duplication
* @param integer $mode Cloning mode (defines filter for objects cloning)
* @returns Zend_Pdf_Element
*/
public function makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
{
$id = spl_object_hash($this);
if (isset($processed[$id])) {
// Do nothing if object is already processed
// return it
return $processed[$id];
}
$streamValue = $this->_value;
$streamDictionary = $this->_dictionary->makeClone($factory, $processed, $mode);
// Make new empty instance of stream object and register it in $processed container
$processed[$id] = $clonedObject = $factory->newStreamObject('');
// Copy current object data and state
$clonedObject->_dictionary = $this->_dictionary->makeClone($factory, $processed, $mode);
$clonedObject->_value = $this->_value->makeClone($factory, $processed, $mode);
$clonedObject->_initialDictionaryData = $this->_initialDictionaryData;
$clonedObject->_streamDecoded = $this->_streamDecoded;
return $clonedObject;
}
开发者ID:Yaoming9,项目名称:Projet-Web-PhP,代码行数:27,代码来源:Stream.php
示例8: toString
/**
* Return string trailer representation
*
* @return string
*/
public function toString()
{
return "trailer\r" . $this->_dict->toString() . "\r";
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:9,代码来源:Trailer.php
示例9: dumpOutline
/**
* Dump Outline and its child outlines into PDF structures
*
* Returns dictionary indirect object or reference
*
* @internal
* @param Zend_Pdf_ElementFactory $factory object factory for newly created indirect objects
* @param boolean $updateNavigation Update navigation flag
* @param Zend_Pdf_Element $parent Parent outline dictionary reference
* @param Zend_Pdf_Element $prev Previous outline dictionary reference
* @param SplObjectStorage $processedOutlines List of already processed outlines
* @return Zend_Pdf_Element
* @throws Zend_Pdf_Exception
*/
public function dumpOutline(Zend_Pdf_ElementFactory_Interface $factory, $updateNavigation, Zend_Pdf_Element $parent, Zend_Pdf_Element $prev = null, SplObjectStorage $processedOutlines = null)
{
if ($processedOutlines === null) {
$processedOutlines = new SplObjectStorage();
}
$processedOutlines->attach($this);
if ($updateNavigation) {
$this->_outlineDictionary->touch();
$this->_outlineDictionary->Parent = $parent;
$this->_outlineDictionary->Prev = $prev;
$this->_outlineDictionary->Next = null;
}
$updateChildNavigation = false;
if (count($this->_originalChildOutlines) != count($this->childOutlines)) {
// If original and current children arrays have different size then children list was updated
$updateChildNavigation = true;
} else {
if (!(array_keys($this->_originalChildOutlines) === array_keys($this->childOutlines))) {
// If original and current children arrays have different keys (with a glance to an order) then children list was updated
$updateChildNavigation = true;
} else {
foreach ($this->childOutlines as $key => $childOutline) {
if ($this->_originalChildOutlines[$key] !== $childOutline) {
$updateChildNavigation = true;
break;
}
}
}
}
$lastChild = null;
if ($updateChildNavigation) {
$this->_outlineDictionary->touch();
$this->_outlineDictionary->First = null;
foreach ($this->childOutlines as $childOutline) {
if ($processedOutlines->contains($childOutline)) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outlines cyclyc reference is detected.');
}
if ($lastChild === null) {
// First pass. Update Outlines dictionary First entry using corresponding value
$lastChild = $childOutline->dumpOutline($factory, $updateChildNavigation, $this->_outlineDictionary, null, $processedOutlines);
$this->_outlineDictionary->First = $lastChild;
} else {
// Update previous outline dictionary Next entry (Prev is updated within dumpOutline() method)
$childOutlineDictionary = $childOutline->dumpOutline($factory, $updateChildNavigation, $this->_outlineDictionary, $lastChild, $processedOutlines);
$lastChild->Next = $childOutlineDictionary;
$lastChild = $childOutlineDictionary;
}
}
$this->_outlineDictionary->Last = $lastChild;
if (count($this->childOutlines) != 0) {
$this->_outlineDictionary->Count = new Zend_Pdf_Element_Numeric(($this->isOpen() ? 1 : -1) * count($this->childOutlines));
} else {
$this->_outlineDictionary->Count = null;
}
} else {
foreach ($this->childOutlines as $childOutline) {
if ($processedOutlines->contains($childOutline)) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outlines cyclyc reference is detected.');
}
$lastChild = $childOutline->dumpOutline($factory, $updateChildNavigation, $this->_outlineDictionary, $lastChild, $processedOutlines);
}
}
return $this->_outlineDictionary;
}
开发者ID:Yaoming9,项目名称:Projet-Web-PhP,代码行数:80,代码来源:Loaded.php
注:本文中的Zend_Pdf_Element_Dictionary类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论