|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Pdf |
|
17 * @subpackage Destination |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: Named.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
21 */ |
|
22 |
|
23 /** Internally used classes */ |
|
24 require_once 'Zend/Pdf/Element.php'; |
|
25 require_once 'Zend/Pdf/Element/String.php'; |
|
26 |
|
27 |
|
28 /** Zend_Pdf_Destination */ |
|
29 require_once 'Zend/Pdf/Destination.php'; |
|
30 |
|
31 /** |
|
32 * Destination array: [page /Fit] |
|
33 * |
|
34 * Display the page designated by page, with its contents magnified just enough |
|
35 * to fit the entire page within the window both horizontally and vertically. If |
|
36 * the required horizontal and vertical magnification factors are different, use |
|
37 * the smaller of the two, centering the page within the window in the other |
|
38 * dimension. |
|
39 * |
|
40 * @package Zend_Pdf |
|
41 * @subpackage Destination |
|
42 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
43 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
44 */ |
|
45 class Zend_Pdf_Destination_Named extends Zend_Pdf_Destination |
|
46 { |
|
47 /** |
|
48 * Destination name |
|
49 * |
|
50 * @var Zend_Pdf_Element_Name|Zend_Pdf_Element_String |
|
51 */ |
|
52 protected $_nameElement; |
|
53 |
|
54 /** |
|
55 * Named destination object constructor |
|
56 * |
|
57 * @param $resource |
|
58 * @throws Zend_Pdf_Exception |
|
59 */ |
|
60 public function __construct(Zend_Pdf_Element $resource) |
|
61 { |
|
62 if ($resource->getType() != Zend_Pdf_Element::TYPE_NAME && $resource->getType() != Zend_Pdf_Element::TYPE_STRING) { |
|
63 require_once 'Zend/Pdf/Exception.php'; |
|
64 throw new Zend_Pdf_Exception('Named destination resource must be a PDF name or a PDF string.'); |
|
65 } |
|
66 |
|
67 $this->_nameElement = $resource; |
|
68 } |
|
69 |
|
70 /** |
|
71 * Create named destination object |
|
72 * |
|
73 * @param string $name |
|
74 * @return Zend_Pdf_Destination_Named |
|
75 */ |
|
76 public static function create($name) |
|
77 { |
|
78 return new Zend_Pdf_Destination_Named(new Zend_Pdf_Element_String($name)); |
|
79 } |
|
80 |
|
81 /** |
|
82 * Get name |
|
83 * |
|
84 * @return Zend_Pdf_Element |
|
85 */ |
|
86 public function getName() |
|
87 { |
|
88 return $this->_nameElement->value; |
|
89 } |
|
90 |
|
91 /** |
|
92 * Get resource |
|
93 * |
|
94 * @internal |
|
95 * @return Zend_Pdf_Element |
|
96 */ |
|
97 public function getResource() |
|
98 { |
|
99 return $this->_nameElement; |
|
100 } |
|
101 } |