public function testDump() { $factory = new ObjectFactory(1); $intObj = new InternalType\NumericObject(100); $obj = new InternalType\IndirectObject($intObj, 55, 3, $factory); $this->assertEquals($obj->dump($factory), "55 3 obj \n100\nendobj\n"); }
/** * 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 \ZendPdf\Annotation\AbstractAnnotation */ public function setText($text) { if ($this->_annotationDictionary->Contents === null) { $this->_annotationDictionary->touch(); $this->_annotationDictionary->Contents = new InternalType\StringObject($text); } else { $this->_annotationDictionary->Contents->touch(); $this->_annotationDictionary->Contents->value = new InternalType\StringObject($text); } return $this; }
/** * Object constructor * * @param mixed $val * @param integer $objNum * @param integer $genNum * @param \ZendPdf\ObjectFactory $factory * @param \ZendPdf\InternalType\DictionaryObject|null $dictionary * @throws \ZendPdf\Exception\ExceptionInterface */ public function __construct($val, $objNum, $genNum, ObjectFactory $factory, $dictionary = null) { parent::__construct(new StreamContent($val), $objNum, $genNum, $factory); if ($dictionary === null) { $this->_dictionary = new DictionaryObject(); $this->_dictionary->Length = new NumericObject(strlen($val)); $this->_streamDecoded = true; } else { $this->_dictionary = $dictionary; $this->_streamDecoded = false; } }
/** * Generate new \ZendPdf\InternalType\IndirectObject * * @todo Reusage of the freed object. It's not a support of new feature, but only improvement. * * @param \ZendPdf\InternalType\AbstractTypeObject $objectValue * @return \ZendPdf\InternalType\IndirectObject */ public function newObject(InternalType\AbstractTypeObject $objectValue) { $obj = new InternalType\IndirectObject($objectValue, $this->_objectCount++, 0, $this); $this->_modifiedObjects[$obj->getObjNum()] = $obj; return $obj; }
/** * Mark object as modified, to include it into new PDF file segment. * * We don't automate this action to keep control on PDF update process. * All new objects are treated as "modified" automatically. */ public function touch() { if ($this->_parentObject !== null) { $this->_parentObject->touch(); } }