File indexing completed on 2024-12-22 05:36:54
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 /** Internally used classes */ 0024 // require_once 'Zend/Pdf/Element.php'; 0025 // require_once 'Zend/Pdf/Element/String.php'; 0026 0027 0028 /** Zend_Pdf_Destination */ 0029 // require_once 'Zend/Pdf/Destination.php'; 0030 0031 /** 0032 * Destination array: [page /Fit] 0033 * 0034 * Display the page designated by page, with its contents magnified just enough 0035 * to fit the entire page within the window both horizontally and vertically. If 0036 * the required horizontal and vertical magnification factors are different, use 0037 * the smaller of the two, centering the page within the window in the other 0038 * dimension. 0039 * 0040 * @package Zend_Pdf 0041 * @subpackage Destination 0042 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0043 * @license http://framework.zend.com/license/new-bsd New BSD License 0044 */ 0045 class Zend_Pdf_Destination_Named extends Zend_Pdf_Destination 0046 { 0047 /** 0048 * Destination name 0049 * 0050 * @var Zend_Pdf_Element_Name|Zend_Pdf_Element_String 0051 */ 0052 protected $_nameElement; 0053 0054 /** 0055 * Named destination object constructor 0056 * 0057 * @param Zend_Pdf_Element $resource 0058 * @throws Zend_Pdf_Exception 0059 */ 0060 public function __construct(Zend_Pdf_Element $resource) 0061 { 0062 if ($resource->getType() != Zend_Pdf_Element::TYPE_NAME && $resource->getType() != Zend_Pdf_Element::TYPE_STRING) { 0063 // require_once 'Zend/Pdf/Exception.php'; 0064 throw new Zend_Pdf_Exception('Named destination resource must be a PDF name or a PDF string.'); 0065 } 0066 0067 $this->_nameElement = $resource; 0068 } 0069 0070 /** 0071 * Create named destination object 0072 * 0073 * @param string $name 0074 * @return Zend_Pdf_Destination_Named 0075 */ 0076 public static function create($name) 0077 { 0078 return new Zend_Pdf_Destination_Named(new Zend_Pdf_Element_String($name)); 0079 } 0080 0081 /** 0082 * Get name 0083 * 0084 * @return Zend_Pdf_Element 0085 */ 0086 public function getName() 0087 { 0088 return $this->_nameElement->value; 0089 } 0090 0091 /** 0092 * Get resource 0093 * 0094 * @internal 0095 * @return Zend_Pdf_Element 0096 */ 0097 public function getResource() 0098 { 0099 return $this->_nameElement; 0100 } 0101 }