*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Pdf / Destination / FitBoundingBoxVertically.php
blob67af6968a8ff6052e49ba95eae7576be6c5a1682
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
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.
15 * @category Zend
16 * @package Zend_Pdf
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: FitBoundingBoxVertically.php 17182 2009-07-27 13:54:11Z alexander $
23 /** Zend_Pdf_Destination_Explicit */
24 require_once 'Zend/Pdf/Destination/Explicit.php';
27 /**
28 * Zend_Pdf_Destination_FitBoundingBoxVertically explicit detination
30 * Destination array: [page /FitBV left]
32 * (PDF 1.1) Display the page designated by page, with the horizontal coordinate
33 * left positioned at the left edge of the window and the contents of the page
34 * magnified just enough to fit the entire height of its bounding box within the
35 * window.
37 * @package Zend_Pdf
38 * @subpackage Destination
39 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
40 * @license http://framework.zend.com/license/new-bsd New BSD License
42 class Zend_Pdf_Destination_FitBoundingBoxVertically extends Zend_Pdf_Destination_Explicit
44 /**
45 * Create destination object
47 * @param Zend_Pdf_Page|integer $page Page object or page number
48 * @param float $left Left edge of displayed page
49 * @return Zend_Pdf_Destination_FitBoundingBoxVertically
50 * @throws Zend_Pdf_Exception
52 public static function create($page, $left)
54 $destinationArray = new Zend_Pdf_Element_Array();
56 if ($page instanceof Zend_Pdf_Page) {
57 $destinationArray->items[] = $page->getPageDictionary();
58 } else if (is_integer($page)) {
59 $destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
60 } else {
61 require_once 'Zend/Pdf/Exception.php';
62 throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
65 $destinationArray->items[] = new Zend_Pdf_Element_Name('FitBV');
66 $destinationArray->items[] = new Zend_Pdf_Element_Numeric($left);
68 return new Zend_Pdf_Destination_FitBoundingBoxVertically($destinationArray);
71 /**
72 * Get left edge of the displayed page
74 * @return float
76 public function getLeftEdge()
78 return $this->_destinationArray->items[2]->value;
81 /**
82 * Set left edge of the displayed page
84 * @param float $left
85 * @return Zend_Pdf_Action_FitBoundingBoxVertically
87 public function setLeftEdge($left)
89 $this->_destinationArray->items[2] = new Zend_Pdf_Element_Numeric($left);
90 return $this;