newObject(new Zend_Pdf_Element_Dictionary()); } 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.'); } $dictionary->Type = new Zend_Pdf_Element_Name('Action'); $dictionary->S = new Zend_Pdf_Element_Name('GoTo'); $dictionary->Next = null; if (is_string($destination)) { // Named destination $dictionary->D = new Zend_Pdf_Element_String($destination); } else if ($destination instanceof Zend_Pdf_Element_Array) { // DestinationArray $dictionary->D = $destination; } else if ($destination instanceof Zend_Pdf_Destination) { $dictionary->D = $destination->getDestinationArray(); } else { require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception('Wrong $destination parameter type'); } return new Zend_Pdf_Action_GoTo($dictionary, null, new SplObjectStorage()); } /** * Returns goto action destination * (Zend_Pdf_Element_Name or Zend_Pdf_Element_String for named destinations * or Zend_Pdf_Array for explicit destinations) * * @return Zend_Pdf_Destination|string */ public function getDestination() { $destination = $this->_actionDictionary->D; if ($destination instanceof Zend_Pdf_Element_Name || $destination instanceof Zend_Pdf_Element_String) { return $destination->value; } return Zend_Pdf_Destination::load($this->_actionDictionary->D); } }