Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FitBoundingBoxHorizontally.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 
49 {
58  public static function create($page, $top)
59  {
60  $destinationArray = new Zend_Pdf_Element_Array();
61 
62  if ($page instanceof Zend_Pdf_Page) {
63  $destinationArray->items[] = $page->getPageDictionary();
64  } else if (is_integer($page)) {
65  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
66  } else {
67  #require_once 'Zend/Pdf/Exception.php';
68  throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
69  }
70 
71  $destinationArray->items[] = new Zend_Pdf_Element_Name('FitBH');
72  $destinationArray->items[] = new Zend_Pdf_Element_Numeric($top);
73 
74  return new Zend_Pdf_Destination_FitBoundingBoxHorizontally($destinationArray);
75  }
76 
82  public function getTopEdge()
83  {
84  return $this->_destinationArray->items[2]->value;
85  }
86 
93  public function setTopEdge($top)
94  {
95  $this->_destinationArray->items[2] = new Zend_Pdf_Element_Numeric($top);
96  return $this;
97  }
98 }
$page
Definition: pages.php:8