File indexing completed on 2025-01-19 05:21:21
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Pdf 0017 * @subpackage Destination 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 0024 /** Internally used classes */ 0025 // require_once 'Zend/Pdf/Element.php'; 0026 0027 0028 /** Zend_Pdf_Destination */ 0029 // require_once 'Zend/Pdf/Destination.php'; 0030 0031 /** 0032 * Abstract PDF explicit destination representation class 0033 * 0034 * @package Zend_Pdf 0035 * @subpackage Destination 0036 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0037 * @license http://framework.zend.com/license/new-bsd New BSD License 0038 */ 0039 abstract class Zend_Pdf_Destination_Explicit extends Zend_Pdf_Destination 0040 { 0041 /** 0042 * Destination description array 0043 * 0044 * @var Zend_Pdf_Element_Array 0045 */ 0046 protected $_destinationArray; 0047 0048 /** 0049 * True if it's a remote destination 0050 * 0051 * @var boolean 0052 */ 0053 protected $_isRemote; 0054 0055 /** 0056 * Explicit destination object constructor 0057 * 0058 * @param Zend_Pdf_Element $destinationArray 0059 * @throws Zend_Pdf_Exception 0060 */ 0061 public function __construct(Zend_Pdf_Element $destinationArray) 0062 { 0063 if ($destinationArray->getType() != Zend_Pdf_Element::TYPE_ARRAY) { 0064 // require_once 'Zend/Pdf/Exception.php'; 0065 throw new Zend_Pdf_Exception('Explicit destination resource Array must be a direct or an indirect array object.'); 0066 } 0067 0068 $this->_destinationArray = $destinationArray; 0069 0070 switch (count($this->_destinationArray->items)) { 0071 case 0: 0072 // require_once 'Zend/Pdf/Exception.php'; 0073 throw new Zend_Pdf_Exception('Destination array must contain a page reference.'); 0074 break; 0075 0076 case 1: 0077 // require_once 'Zend/Pdf/Exception.php'; 0078 throw new Zend_Pdf_Exception('Destination array must contain a destination type name.'); 0079 break; 0080 0081 default: 0082 // Do nothing 0083 break; 0084 } 0085 0086 switch ($this->_destinationArray->items[0]->getType()) { 0087 case Zend_Pdf_Element::TYPE_NUMERIC: 0088 $this->_isRemote = true; 0089 break; 0090 0091 case Zend_Pdf_Element::TYPE_DICTIONARY: 0092 $this->_isRemote = false; 0093 break; 0094 0095 default: 0096 // require_once 'Zend/Pdf/Exception.php'; 0097 throw new Zend_Pdf_Exception('Destination target must be a page number or page dictionary object.'); 0098 break; 0099 } 0100 } 0101 0102 /** 0103 * Returns true if it's a remote destination 0104 * 0105 * @return boolean 0106 */ 0107 public function isRemote() 0108 { 0109 return $this->_isRemote; 0110 } 0111 0112 /** 0113 * Get resource 0114 * 0115 * @internal 0116 * @return Zend_Pdf_Element 0117 */ 0118 public function getResource() 0119 { 0120 return $this->_destinationArray; 0121 } 0122 }