diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Pdf/Action/GoTo.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Pdf/Action/GoTo.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,116 @@ +_destination = Zend_Pdf_Destination::load($dictionary->D); + } + + /** + * Create new Zend_Pdf_Action_GoTo object using specified destination + * + * @param Zend_Pdf_Destination|string $destination + * @return Zend_Pdf_Action_GoTo + */ + public static function create($destination) + { + if (is_string($destination)) { + require_once 'Zend/Pdf/Destination/Named.php'; + $destination = Zend_Pdf_Destination_Named::create($destination); + } + + if (!$destination instanceof Zend_Pdf_Destination) { + require_once 'Zend/Pdf/Exception.php'; + throw new Zend_Pdf_Exception('$destination parameter must be a Zend_Pdf_Destination object or string.'); + } + + $dictionary = new Zend_Pdf_Element_Dictionary(); + $dictionary->Type = new Zend_Pdf_Element_Name('Action'); + $dictionary->S = new Zend_Pdf_Element_Name('GoTo'); + $dictionary->Next = null; + $dictionary->D = $destination->getResource(); + + return new Zend_Pdf_Action_GoTo($dictionary, new SplObjectStorage()); + } + + /** + * Set goto action destination + * + * @param Zend_Pdf_Destination|string $destination + * @return Zend_Pdf_Action_GoTo + */ + public function setDestination(Zend_Pdf_Destination $destination) + { + $this->_destination = $destination; + + $this->_actionDictionary->touch(); + $this->_actionDictionary->D = $destination->getResource(); + + return $this; + } + + /** + * Get goto action destination + * + * @return Zend_Pdf_Destination + */ + public function getDestination() + { + return $this->_destination; + } +}