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.
17 * @subpackage Destination
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: Destination.php 17182 2009-07-27 13:54:11Z alexander $
23 /** Zend_Pdf_ElementFactory */
24 require_once 'Zend/Pdf/ElementFactory.php';
27 require_once 'Zend/Pdf/Page.php';
29 /** Zend_Pdf_Target */
30 require_once 'Zend/Pdf/Target.php';
34 * Abstract PDF destination representation class
37 * @subpackage Destination
38 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
39 * @license http://framework.zend.com/license/new-bsd New BSD License
41 abstract class Zend_Pdf_Destination
extends Zend_Pdf_Target
44 * Load Destination object from a specified resource
47 * @param $destinationArray
48 * @return Zend_Pdf_Destination
50 public static function load(Zend_Pdf_Element
$resource)
52 if ($resource->getType() == Zend_Pdf_Element
::TYPE_NAME ||
$resource->getType() == Zend_Pdf_Element
::TYPE_STRING
) {
53 require_once 'Zend/Pdf/Destination/Named.php';
54 return new Zend_Pdf_Destination_Named($resource);
57 if ($resource->getType() != Zend_Pdf_Element
::TYPE_ARRAY
) {
58 require_once 'Zend/Pdf/Exception.php';
59 throw new Zend_Pdf_Exception('An explicit destination must be a direct or an indirect array object.');
61 if (count($resource->items
) < 2) {
62 require_once 'Zend/Pdf/Exception.php';
63 throw new Zend_Pdf_Exception('An explicit destination array must contain at least two elements.');
66 switch ($resource->items
[1]->value
) {
68 require_once 'Zend/Pdf/Destination/Zoom.php';
69 return new Zend_Pdf_Destination_Zoom($resource);
73 require_once 'Zend/Pdf/Destination/Fit.php';
74 return new Zend_Pdf_Destination_Fit($resource);
78 require_once 'Zend/Pdf/Destination/FitHorizontally.php';
79 return new Zend_Pdf_Destination_FitHorizontally($resource);
83 require_once 'Zend/Pdf/Destination/FitVertically.php';
84 return new Zend_Pdf_Destination_FitVertically($resource);
88 require_once 'Zend/Pdf/Destination/FitRectangle.php';
89 return new Zend_Pdf_Destination_FitRectangle($resource);
93 require_once 'Zend/Pdf/Destination/FitBoundingBox.php';
94 return new Zend_Pdf_Destination_FitBoundingBox($resource);
98 require_once 'Zend/Pdf/Destination/FitBoundingBoxHorizontally.php';
99 return new Zend_Pdf_Destination_FitBoundingBoxHorizontally($resource);
103 require_once 'Zend/Pdf/Destination/FitBoundingBoxVertically.php';
104 return new Zend_Pdf_Destination_FitBoundingBoxVertically($resource);
108 require_once 'Zend/Pdf/Destination/Unknown.php';
109 return new Zend_Pdf_Destination_Unknown($resource);