Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Zoom.php
Go to the documentation of this file.
1 <?php
24 #require_once 'Zend/Pdf/Element/Array.php';
25 #require_once 'Zend/Pdf/Element/Name.php';
26 #require_once 'Zend/Pdf/Element/Null.php';
27 #require_once 'Zend/Pdf/Element/Numeric.php';
28 
29 
31 #require_once 'Zend/Pdf/Destination/Explicit.php';
32 
50 {
61  public static function create($page, $left = null, $top = null, $zoom = null)
62  {
63  $destinationArray = new Zend_Pdf_Element_Array();
64 
65  if ($page instanceof Zend_Pdf_Page) {
66  $destinationArray->items[] = $page->getPageDictionary();
67  } else if (is_integer($page)) {
68  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
69  } else {
70  #require_once 'Zend/Pdf/Exception.php';
71  throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
72  }
73 
74  $destinationArray->items[] = new Zend_Pdf_Element_Name('XYZ');
75 
76  if ($left === null) {
77  $destinationArray->items[] = new Zend_Pdf_Element_Null();
78  } else {
79  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($left);
80  }
81 
82  if ($top === null) {
83  $destinationArray->items[] = new Zend_Pdf_Element_Null();
84  } else {
85  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($top);
86  }
87 
88  if ($zoom === null) {
89  $destinationArray->items[] = new Zend_Pdf_Element_Null();
90  } else {
91  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($zoom);
92  }
93 
94  return new Zend_Pdf_Destination_Zoom($destinationArray);
95  }
96 
102  public function getLeftEdge()
103  {
104  return $this->_destinationArray->items[2]->value;
105  }
106 
113  public function setLeftEdge($left)
114  {
115  if ($left === null) {
116  $this->_destinationArray->items[2] = new Zend_Pdf_Element_Null();
117  } else {
118  $this->_destinationArray->items[2] = new Zend_Pdf_Element_Numeric($left);
119  }
120 
121  return $this;
122  }
123 
129  public function getTopEdge()
130  {
131  return $this->_destinationArray->items[3]->value;
132  }
133 
140  public function setTopEdge($top)
141  {
142  if ($top === null) {
143  $this->_destinationArray->items[3] = new Zend_Pdf_Element_Null();
144  } else {
145  $this->_destinationArray->items[3] = new Zend_Pdf_Element_Numeric($top);
146  }
147 
148  return $this;
149  }
150 
156  public function getZoomFactor()
157  {
158  return $this->_destinationArray->items[4]->value;
159  }
160 
167  public function setZoomFactor($zoom)
168  {
169  if ($zoom === null) {
170  $this->_destinationArray->items[4] = new Zend_Pdf_Element_Null();
171  } else {
172  $this->_destinationArray->items[4] = new Zend_Pdf_Element_Numeric($zoom);
173  }
174 
175  return $this;
176  }
177 }
static create($page, $left=null, $top=null, $zoom=null)
Definition: Zoom.php:61
$page
Definition: pages.php:8