Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FitRectangle.php
Go to the documentation of this file.
1 <?php
25 #require_once 'Zend/Pdf/Element/Array.php';
26 #require_once 'Zend/Pdf/Element/Name.php';
27 #require_once 'Zend/Pdf/Element/Numeric.php';
28 
29 
31 #require_once 'Zend/Pdf/Destination/Explicit.php';
32 
50 {
62  public static function create($page, $left, $bottom, $right, $top)
63  {
64  $destinationArray = new Zend_Pdf_Element_Array();
65 
66  if ($page instanceof Zend_Pdf_Page) {
67  $destinationArray->items[] = $page->getPageDictionary();
68  } else if (is_integer($page)) {
69  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
70  } else {
71  #require_once 'Zend/Pdf/Exception.php';
72  throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
73  }
74 
75  $destinationArray->items[] = new Zend_Pdf_Element_Name('FitR');
76  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($left);
77  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($bottom);
78  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($right);
79  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($top);
80 
81  return new Zend_Pdf_Destination_FitRectangle($destinationArray);
82  }
83 
89  public function getLeftEdge()
90  {
91  return $this->_destinationArray->items[2]->value;
92  }
93 
100  public function setLeftEdge($left)
101  {
102  $this->_destinationArray->items[2] = new Zend_Pdf_Element_Numeric($left);
103  return $this;
104  }
105 
111  public function getBottomEdge()
112  {
113  return $this->_destinationArray->items[3]->value;
114  }
115 
122  public function setBottomEdge($bottom)
123  {
124  $this->_destinationArray->items[3] = new Zend_Pdf_Element_Numeric($bottom);
125  return $this;
126  }
127 
133  public function getRightEdge()
134  {
135  return $this->_destinationArray->items[4]->value;
136  }
137 
144  public function setRightEdge($right)
145  {
146  $this->_destinationArray->items[4] = new Zend_Pdf_Element_Numeric($right);
147  return $this;
148  }
149 
155  public function getTopEdge()
156  {
157  return $this->_destinationArray->items[5]->value;
158  }
159 
166  public function setTopEdge($top)
167  {
168  $this->_destinationArray->items[5] = new Zend_Pdf_Element_Numeric($top);
169  return $this;
170  }
171 }
static create($page, $left, $bottom, $right, $top)
$page
Definition: pages.php:8