Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Annotation.php
Go to the documentation of this file.
1 <?php
24 #require_once 'Zend/Pdf/Element.php';
25 
38 abstract class Zend_Pdf_Annotation
39 {
46 
53  public function getResource()
54  {
56  }
57 
58 
65  public function setBottom($bottom) {
66  $this->_annotationDictionary->Rect->items[1]->touch();
67  $this->_annotationDictionary->Rect->items[1]->value = $bottom;
68 
69  return $this;
70  }
71 
77  public function getBottom() {
78  return $this->_annotationDictionary->Rect->items[1]->value;
79  }
80 
87  public function setTop($top) {
88  $this->_annotationDictionary->Rect->items[3]->touch();
89  $this->_annotationDictionary->Rect->items[3]->value = $top;
90 
91  return $this;
92  }
93 
99  public function getTop() {
100  return $this->_annotationDictionary->Rect->items[3]->value;
101  }
102 
109  public function setRight($right) {
110  $this->_annotationDictionary->Rect->items[2]->touch();
111  $this->_annotationDictionary->Rect->items[2]->value = $right;
112 
113  return $this;
114  }
115 
121  public function getRight() {
122  return $this->_annotationDictionary->Rect->items[2]->value;
123  }
124 
131  public function setLeft($left) {
132  $this->_annotationDictionary->Rect->items[0]->touch();
133  $this->_annotationDictionary->Rect->items[0]->value = $left;
134 
135  return $this;
136  }
137 
143  public function getLeft() {
144  return $this->_annotationDictionary->Rect->items[0]->value;
145  }
146 
154  public function getText() {
155  if ($this->_annotationDictionary->Contents === null) {
156  return '';
157  }
158 
159  return $this->_annotationDictionary->Contents->value;
160  }
161 
170  public function setText($text) {
171  #require_once 'Zend/Pdf/Element/String.php';
172 
173  if ($this->_annotationDictionary->Contents === null) {
174  $this->_annotationDictionary->touch();
175  $this->_annotationDictionary->Contents = new Zend_Pdf_Element_String($text);
176  } else {
177  $this->_annotationDictionary->Contents->touch();
178  $this->_annotationDictionary->Contents->value = new Zend_Pdf_Element_String($text);
179  }
180 
181  return $this;
182  }
183 
189  public function __construct(Zend_Pdf_Element $annotationDictionary)
190  {
191  if ($annotationDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
192  #require_once 'Zend/Pdf/Exception.php';
193  throw new Zend_Pdf_Exception('Annotation dictionary resource has to be a dictionary.');
194  }
195 
196  $this->_annotationDictionary = $annotationDictionary;
197 
198  if ($this->_annotationDictionary->Type !== null &&
199  $this->_annotationDictionary->Type->value != 'Annot') {
200  #require_once 'Zend/Pdf/Exception.php';
201  throw new Zend_Pdf_Exception('Wrong resource type. \'Annot\' expected.');
202  }
203 
204  if ($this->_annotationDictionary->Rect === null) {
205  #require_once 'Zend/Pdf/Exception.php';
206  throw new Zend_Pdf_Exception('\'Rect\' dictionary entry is required.');
207  }
208 
209  if (count($this->_annotationDictionary->Rect->items) != 4 ||
210  $this->_annotationDictionary->Rect->items[0]->getType() != Zend_Pdf_Element::TYPE_NUMERIC ||
211  $this->_annotationDictionary->Rect->items[1]->getType() != Zend_Pdf_Element::TYPE_NUMERIC ||
212  $this->_annotationDictionary->Rect->items[2]->getType() != Zend_Pdf_Element::TYPE_NUMERIC ||
213  $this->_annotationDictionary->Rect->items[3]->getType() != Zend_Pdf_Element::TYPE_NUMERIC ) {
214  #require_once 'Zend/Pdf/Exception.php';
215  throw new Zend_Pdf_Exception('\'Rect\' dictionary entry must be an array of four numeric elements.');
216  }
217  }
218 
226  public static function load(Zend_Pdf_Element $resource)
227  {
229  }
230 }
const TYPE_NUMERIC
Definition: Element.php:33
__construct(Zend_Pdf_Element $annotationDictionary)
Definition: Annotation.php:189
endifif( $block->getLastPageNum()>1)( 'Page') ?></strong >< ul class $text
Definition: pager.phtml:43
$resource
Definition: bulk.php:12
const TYPE_DICTIONARY
Definition: Element.php:37
static load(Zend_Pdf_Element $resource)
Definition: Annotation.php:226