Exemplo n.º 1
0
 /**
  * Create new \ZendPdf\Action\GoToAction object using specified destination
  *
  * @param \ZendPdf\Destination\AbstractDestination|string $destination
  * @return \ZendPdf\Action\GoToAction
  */
 public static function create($destination)
 {
     if (is_string($destination)) {
         $destination = Destination\Named::create($destination);
     }
     if (!$destination instanceof Destination\AbstractDestination) {
         throw new Exception\InvalidArgumentException('$destination parameter must be a \\ZendPdf\\Destination object or string.');
     }
     $dictionary = new InternalType\DictionaryObject();
     $dictionary->Type = new InternalType\NameObject('Action');
     $dictionary->S = new InternalType\NameObject('GoTo');
     $dictionary->Next = null;
     $dictionary->D = $destination->getResource();
     return new self($dictionary, new \SplObjectStorage());
 }
Exemplo n.º 2
0
 /**
  * Set outline target.
  * Null means no target
  *
  * @param \ZendPdf\InternalStructure\NavigationTarget|string $target
  * @return \ZendPdf\Outline\AbstractOutline
  * @throws \ZendPdf\Exception\ExceptionInterface
  */
 public function setTarget($target = null)
 {
     $this->_outlineDictionary->touch();
     if (is_string($target)) {
         $target = Destination\Named::create($target);
     }
     if ($target === null) {
         $this->_outlineDictionary->Dest = null;
         $this->_outlineDictionary->A = null;
     } elseif ($target instanceof Destination\AbstractDestination) {
         $this->_outlineDictionary->Dest = $target->getResource();
         $this->_outlineDictionary->A = null;
     } elseif ($target instanceof Action\AbstractAction) {
         $this->_outlineDictionary->Dest = null;
         $this->_outlineDictionary->A = $target->getResource();
     } else {
         throw new Exception\CorruptedPdfException('Outline target has to be \\ZendPdf\\Destination\\AbstractDestination or \\ZendPdf\\AbstractAction object or string');
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Set link annotation destination
  *
  * @param \ZendPdf\InternalStructure\NavigationTarget|string $target
  * @return \ZendPdf\Annotation\Link
  */
 public function setDestination($target)
 {
     if (is_string($target)) {
         $destination = Destination\Named::create($target);
     }
     if (!$target instanceof InternalStructure\NavigationTarget) {
         throw new Exception\InvalidArgumentException('$target parameter must be a \\ZendPdf\\InternalStructure\\NavigationTarget object or a string.');
     }
     $this->_annotationDictionary->touch();
     $this->_annotationDictionary->Dest = $destination->getResource();
     if ($target instanceof Destination\AbstractDestination) {
         $this->_annotationDictionary->Dest = $target->getResource();
         $this->_annotationDictionary->A = null;
     } else {
         $this->_annotationDictionary->Dest = null;
         $this->_annotationDictionary->A = $target->getResource();
     }
     return $this;
 }