/** * 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"; }
/** * Return string trailer representation * * @return string */ public function toString() { return "trailer\r" . $this->_dict->toString() . "\r"; }
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) >>'); }