当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Pdf_Destination类代码示例

本文整理汇总了PHP中Zend_Pdf_Destination的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf_Destination类的具体用法?PHP Zend_Pdf_Destination怎么用?PHP Zend_Pdf_Destination使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Zend_Pdf_Destination类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * 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.');
     }
 }
开发者ID:conectapb,项目名称:sysagroweb,代码行数:34,代码来源:Target.php

示例2: setDestination

 /**
  * 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;
 }
开发者ID:Yaoming9,项目名称:Projet-Web-PhP,代码行数:13,代码来源:GoTo.php

示例3: load

 /**
  * 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.');
         }
     }
 }
开发者ID:jingjangjung,项目名称:Storefront,代码行数:22,代码来源:Target.php

示例4: getTarget

 /**
  * 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;
 }
开发者ID:Yaoming9,项目名称:Projet-Web-PhP,代码行数:23,代码来源:Loaded.php

示例5: resolveDestination

    /**
     * Resolve destination.
     *
     * Returns Zend_Pdf_Page page object or null if destination is not found within PDF document.
     *
     * @param Zend_Pdf_Destination $destination  Destination to resolve
     * @param boolean $refreshPagesHash  Refresh page collection hashes before processing
     * @return Zend_Pdf_Page|null
     * @throws Zend_Pdf_Exception
     */
    public function resolveDestination(Zend_Pdf_Destination $destination, $refreshPageCollectionHashes = true)
    {
        if ($this->_pageReferences === null  ||  $refreshPageCollectionHashes) {
            $this->_refreshPagesHash();
        }

        if ($destination instanceof Zend_Pdf_Destination_Named) {
            if (!isset($this->_namedTargets[$destination->getName()])) {
                return null;
            }
            $destination = $this->getNamedDestination($destination->getName());

            if ($destination instanceof Zend_Pdf_Action) {
                if (!$destination instanceof Zend_Pdf_Action_GoTo) {
                    return null;
                }
                $destination = $destination->getDestination();
            }

            if (!$destination instanceof Zend_Pdf_Destination_Explicit) {
                require_once 'Zend/Pdf/Exception.php';
                throw new Zend_Pdf_Exception('Named destination target has to be an explicit destination.');
            }
        }

        // Named target is an explicit destination
        $pageElement = $destination->getResource()->items[0];

        if ($pageElement->getType() == Zend_Pdf_Element::TYPE_NUMERIC) {
            // Page reference is a PDF number
            if (!isset($this->_pageNumbers[$pageElement->value])) {
                return null;
            }

            return $this->_pageNumbers[$pageElement->value];
        }

        // Page reference is a PDF page dictionary reference
        $pageDictionaryHashId = spl_object_hash($pageElement->getObject());
        if (!isset($this->_pageReferences[$pageDictionaryHashId])) {
            return null;
        }
        return $this->_pageReferences[$pageDictionaryHashId];
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:54,代码来源:Pdf.php

示例6: getDestination

 /**
  * 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);
     }
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:18,代码来源:Link.php

示例7: testGettersSetters

 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);
 }
开发者ID:omusico,项目名称:logica,代码行数:91,代码来源:DestinationTest.php

示例8: getDestination

 /**
  * 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);
     }
 }
开发者ID:robeendey,项目名称:ce,代码行数:16,代码来源:Link.php


注:本文中的Zend_Pdf_Destination类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。