Exemplo n.º 1
0
 /**
  * Create new \Zend\Pdf\Action\GoToAction object using specified destination
  *
  * @param \Zend\Pdf\Destination\AbstractDestination|string $destination
  * @return \Zend\Pdf\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 \\Zend\\Pdf\\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 link annotation destination
  *
  * @param \Zend\Pdf\InternalStructure\NavigationTarget|string $target
  * @return \Zend\Pdf\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 \\Zend\\Pdf\\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;
 }
Exemplo n.º 3
0
 /**
  * Set outline target.
  * Null means no target
  *
  * @param \Zend\Pdf\InternalStructure\NavigationTarget|string $target
  * @return \Zend\Pdf\Outline\AbstractOutline
  * @throws \Zend\Pdf\Exception
  */
 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;
     } else {
         if ($target instanceof Destination\AbstractDestination) {
             $this->_outlineDictionary->Dest = $target->getResource();
             $this->_outlineDictionary->A = null;
         } else {
             if ($target instanceof Action\AbstractAction) {
                 $this->_outlineDictionary->Dest = null;
                 $this->_outlineDictionary->A = $target->getResource();
             } else {
                 throw new Exception\CorruptedPdfException('Outline target has to be \\Zend\\Pdf\\Destination\\AbstractDestination or \\Zend\\Pdf\\AbstractAction object or string');
             }
         }
     }
     return $this;
 }