コード例 #1
0
ファイル: Target.php プロジェクト: conectapb/sysagroweb
 /**
  * Parse resource and return it as an Action or Explicit Destination
  *
  * $param Zend_Pdf_Element $resource
  * @return Zend_Pdf_Destination|
  * @throws Zend_Pdf_Exception
  */
 public static function load(Zend_Pdf_Element $resource)
 {
     require_once 'Zend/Pdf/Element.php';
     if ($resource->getType() == Zend_Pdf_Element::TYPE_DICTIONARY) {
         if (($resource->Type === null || $resource->Type->value == 'Action') && $resource->S !== null) {
             // It's a well-formed action, load it
             require_once 'Zend/Pdf/Action.php';
             return Zend_Pdf_Action::load($resource);
         } else {
             if ($resource->D !== null) {
                 // It's a destination
                 $resource = $resource->D;
             } else {
                 require_once 'Zend/Pdf/Exception.php';
                 throw new Zend_Pdf_Exception('Wrong resource type.');
             }
         }
     }
     if ($resource->getType() == Zend_Pdf_Element::TYPE_ARRAY || $resource->getType() == Zend_Pdf_Element::TYPE_NAME || $resource->getType() == Zend_Pdf_Element::TYPE_STRING) {
         // Resource is an array, just treat it as an explicit destination array
         require_once 'Zend/Pdf/Destination.php';
         return Zend_Pdf_Destination::load($resource);
     } else {
         require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception('Wrong resource type.');
     }
 }
コード例 #2
0
ファイル: Target.php プロジェクト: jingjangjung/Storefront
 /**
  * Parse resource and return it as an Action or Explicit Destination
  *
  * $param Zend_Pdf_Element $resource
  * @return Zend_Pdf_Destination|
  * @throws Zend_Pdf_Exception
  */
 public static function load(Zend_Pdf_Element $resource)
 {
     if ($resource->getType() == Zend_Pdf_Element::TYPE_DICTIONARY) {
         // Load destination as appropriate action
         return Zend_Pdf_Action::load($resource);
     } else {
         if ($resource->getType() == Zend_Pdf_Element::TYPE_ARRAY || $resource->getType() == Zend_Pdf_Element::TYPE_NAME || $resource->getType() == Zend_Pdf_Element::TYPE_STRING) {
             // Resource is an array, just treat it as an explicit destination array
             return Zend_Pdf_Destination::load($resource);
         } else {
             require_once 'Zend/Pdf/Exception.php';
             throw new Zend_Pdf_Exception('Wrong resource type.');
         }
     }
 }
コード例 #3
0
ファイル: GoTo.php プロジェクト: Yaoming9/Projet-Web-PhP
 /**
  * Object constructor
  *
  * @param Zend_Pdf_Element_Dictionary $dictionary
  * @param SplObjectStorage            $processedActions  list of already processed action dictionaries, used to avoid cyclic references
  */
 public function __construct(Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions)
 {
     parent::__construct($dictionary, $processedActions);
     $this->_destination = Zend_Pdf_Destination::load($dictionary->D);
 }
コード例 #4
0
ファイル: Loaded.php プロジェクト: Yaoming9/Projet-Web-PhP
 /**
  * Get outline target.
  *
  * @return Zend_Pdf_Target
  * @throws Zend_Pdf_Exception
  */
 public function getTarget()
 {
     if ($this->_outlineDictionary->Dest !== null) {
         if ($this->_outlineDictionary->A !== null) {
             require_once 'Zend/Pdf/Exception.php';
             throw new Zend_Pdf_Exception('Outline dictionary may contain Dest or A entry, but not both.');
         }
         require_once 'Zend/Pdf/Destination.php';
         return Zend_Pdf_Destination::load($this->_outlineDictionary->Dest);
     } else {
         if ($this->_outlineDictionary->A !== null) {
             require_once 'Zend/Pdf/Action.php';
             return Zend_Pdf_Action::load($this->_outlineDictionary->A);
         }
     }
     return null;
 }
コード例 #5
0
 /**
  * Get link annotation destination
  *
  * @return Zend_Pdf_Target|null
  */
 public function getDestination()
 {
     if ($this->_annotationDictionary->Dest === null && $this->_annotationDictionary->A === null) {
         return null;
     }
     if ($this->_annotationDictionary->Dest !== null) {
         #require_once 'Zend/Pdf/Destination.php';
         return Zend_Pdf_Destination::load($this->_annotationDictionary->Dest);
     } else {
         #require_once 'Zend/Pdf/Action.php';
         return Zend_Pdf_Action::load($this->_annotationDictionary->A);
     }
 }
コード例 #6
0
ファイル: DestinationTest.php プロジェクト: omusico/logica
 public function testGettersSetters()
 {
     $pdf = new Zend_Pdf();
     $page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     $page2 = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
     // Zend_Pdf_Destination_Zoom
     $destArray = new Zend_Pdf_Element_Array();
     $destArray->items[] = $page2->getPageDictionary();
     $destArray->items[] = new Zend_Pdf_Element_Name('XYZ');
     $destArray->items[] = new Zend_Pdf_Element_Numeric(0);
     // left
     $destArray->items[] = new Zend_Pdf_Element_Numeric(842);
     // top
     $destArray->items[] = new Zend_Pdf_Element_Numeric(1);
     // zoom
     $destination = Zend_Pdf_Destination::load($destArray);
     $this->assertEquals($destination->getLeftEdge(), 0);
     $destination->setLeftEdge(5);
     $this->assertEquals($destination->getLeftEdge(), 5);
     $this->assertEquals($destination->getTopEdge(), 842);
     $destination->setTopEdge(825);
     $this->assertEquals($destination->getTopEdge(), 825);
     $this->assertEquals($destination->getZoomFactor(), 1);
     $destination->setZoomFactor(0.5);
     $this->assertEquals($destination->getZoomFactor(), 0.5);
     // Zend_Pdf_Destination_FitHorizontally
     $destArray = new Zend_Pdf_Element_Array();
     $destArray->items[] = $page2->getPageDictionary();
     $destArray->items[] = new Zend_Pdf_Element_Name('FitH');
     $destArray->items[] = new Zend_Pdf_Element_Numeric(842);
     // top
     $destination = Zend_Pdf_Destination::load($destArray);
     $this->assertEquals($destination->getTopEdge(), 842);
     $destination->setTopEdge(825);
     $this->assertEquals($destination->getTopEdge(), 825);
     // Zend_Pdf_Destination_FitVertically
     $destArray = new Zend_Pdf_Element_Array();
     $destArray->items[] = $page2->getPageDictionary();
     $destArray->items[] = new Zend_Pdf_Element_Name('FitV');
     $destArray->items[] = new Zend_Pdf_Element_Numeric(0);
     // left
     $destination = Zend_Pdf_Destination::load($destArray);
     $this->assertEquals($destination->getLeftEdge(), 0);
     $destination->setLeftEdge(5);
     $this->assertEquals($destination->getLeftEdge(), 5);
     // Zend_Pdf_Destination_FitRectangle
     $destArray = new Zend_Pdf_Element_Array();
     $destArray->items[] = $page2->getPageDictionary();
     $destArray->items[] = new Zend_Pdf_Element_Name('FitR');
     $destArray->items[] = new Zend_Pdf_Element_Numeric(0);
     // left
     $destArray->items[] = new Zend_Pdf_Element_Numeric(10);
     // bottom
     $destArray->items[] = new Zend_Pdf_Element_Numeric(595);
     // right
     $destArray->items[] = new Zend_Pdf_Element_Numeric(842);
     // top
     $destination = Zend_Pdf_Destination::load($destArray);
     $this->assertEquals($destination->getLeftEdge(), 0);
     $destination->setLeftEdge(5);
     $this->assertEquals($destination->getLeftEdge(), 5);
     $this->assertEquals($destination->getBottomEdge(), 10);
     $destination->setBottomEdge(20);
     $this->assertEquals($destination->getBottomEdge(), 20);
     $this->assertEquals($destination->getRightEdge(), 595);
     $destination->setRightEdge(590);
     $this->assertEquals($destination->getRightEdge(), 590);
     $this->assertEquals($destination->getTopEdge(), 842);
     $destination->setTopEdge(825);
     $this->assertEquals($destination->getTopEdge(), 825);
     // Zend_Pdf_Destination_FitBoundingBoxHorizontally
     $destArray = new Zend_Pdf_Element_Array();
     $destArray->items[] = $page2->getPageDictionary();
     $destArray->items[] = new Zend_Pdf_Element_Name('FitBH');
     $destArray->items[] = new Zend_Pdf_Element_Numeric(842);
     // top
     $destination = Zend_Pdf_Destination::load($destArray);
     $this->assertEquals($destination->getTopEdge(), 842);
     $destination->setTopEdge(825);
     $this->assertEquals($destination->getTopEdge(), 825);
     // Zend_Pdf_Destination_FitBoundingBoxVertically
     $destArray = new Zend_Pdf_Element_Array();
     $destArray->items[] = $page2->getPageDictionary();
     $destArray->items[] = new Zend_Pdf_Element_Name('FitBV');
     $destArray->items[] = new Zend_Pdf_Element_Numeric(0);
     // left
     $destination = Zend_Pdf_Destination::load($destArray);
     $this->assertEquals($destination->getLeftEdge(), 0);
     $destination->setLeftEdge(5);
     $this->assertEquals($destination->getLeftEdge(), 5);
 }
コード例 #7
0
ファイル: Link.php プロジェクト: robeendey/ce
 /**
  * Get link annotation destination
  *
  * @return Zend_Pdf_Target|null
  */
 public function getDestination()
 {
     if ($this->_annotationDictionary->Dest === null && $this->_annotationDictionary->A === null) {
         return null;
     }
     if ($this->_annotationDictionary->Dest !== null) {
         return Zend_Pdf_Destination::load($this->_annotationDictionary->Dest);
     } else {
         return Zend_Pdf_Action::load($this->_annotationDictionary->A);
     }
 }