_parentObject = $parent; } /** * Get top level parent indirect object. * * @return Zend_Pdf_Element_Object */ public function getParentObject() { return $this->_parentObject; } /** * 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(); } } /** * Clean up resources, used by object */ public function cleanUp() { // Do nothing } /** * Convert PDF element to PHP type. * * @return mixed */ public function toPhp() { return $this->value; } /** * Convert PHP value into PDF element. * * @param mixed $input * @return Zend_Pdf_Element */ public static function phpToPdf($input) { if (is_numeric($input)) { #require_once 'Zend/Pdf/Element/Numeric.php'; return new Zend_Pdf_Element_Numeric($input); } else if (is_bool($input)) { #require_once 'Zend/Pdf/Element/Boolean.php'; return new Zend_Pdf_Element_Boolean($input); } else if (is_array($input)) { $pdfElementsArray = array(); $isDictionary = false; foreach ($input as $key => $value) { if (is_string($key)) { $isDictionary = true; } $pdfElementsArray[$key] = Zend_Pdf_Element::phpToPdf($value); } if ($isDictionary) { #require_once 'Zend/Pdf/Element/Dictionary.php'; return new Zend_Pdf_Element_Dictionary($pdfElementsArray); } else { #require_once 'Zend/Pdf/Element/Array.php'; return new Zend_Pdf_Element_Array($pdfElementsArray); } } else { #require_once 'Zend/Pdf/Element/String.php'; return new Zend_Pdf_Element_String((string)$input); } } }