Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Markup.php
Go to the documentation of this file.
1 <?php
24 #require_once 'Zend/Pdf/Element.php';
25 #require_once 'Zend/Pdf/Element/Array.php';
26 #require_once 'Zend/Pdf/Element/Dictionary.php';
27 #require_once 'Zend/Pdf/Element/Name.php';
28 #require_once 'Zend/Pdf/Element/Numeric.php';
29 #require_once 'Zend/Pdf/Element/String.php';
30 
31 
33 #require_once 'Zend/Pdf/Annotation.php';
34 
44 {
48  const SUBTYPE_HIGHLIGHT = 'Highlight';
49  const SUBTYPE_UNDERLINE = 'Underline';
50  const SUBTYPE_SQUIGGLY = 'Squiggly';
51  const SUBTYPE_STRIKEOUT = 'StrikeOut';
52 
58  public function __construct(Zend_Pdf_Element $annotationDictionary)
59  {
60  if ($annotationDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
61  #require_once 'Zend/Pdf/Exception.php';
62  throw new Zend_Pdf_Exception('Annotation dictionary resource has to be a dictionary.');
63  }
64 
65  if ($annotationDictionary->Subtype === null ||
66  $annotationDictionary->Subtype->getType() != Zend_Pdf_Element::TYPE_NAME ||
67  !in_array( $annotationDictionary->Subtype->value,
68  array(self::SUBTYPE_HIGHLIGHT,
69  self::SUBTYPE_UNDERLINE,
70  self::SUBTYPE_SQUIGGLY,
71  self::SUBTYPE_STRIKEOUT) )) {
72  #require_once 'Zend/Pdf/Exception.php';
73  throw new Zend_Pdf_Exception('Subtype => Markup entry is omitted or has wrong value.');
74  }
75 
76  parent::__construct($annotationDictionary);
77  }
78 
114  public static function create($x1, $y1, $x2, $y2, $text, $subType, $quadPoints)
115  {
116  $annotationDictionary = new Zend_Pdf_Element_Dictionary();
117 
118  $annotationDictionary->Type = new Zend_Pdf_Element_Name('Annot');
119  $annotationDictionary->Subtype = new Zend_Pdf_Element_Name($subType);
120 
121  $rectangle = new Zend_Pdf_Element_Array();
122  $rectangle->items[] = new Zend_Pdf_Element_Numeric($x1);
123  $rectangle->items[] = new Zend_Pdf_Element_Numeric($y1);
124  $rectangle->items[] = new Zend_Pdf_Element_Numeric($x2);
125  $rectangle->items[] = new Zend_Pdf_Element_Numeric($y2);
126  $annotationDictionary->Rect = $rectangle;
127 
128  $annotationDictionary->Contents = new Zend_Pdf_Element_String($text);
129 
130  if (!is_array($quadPoints) || count($quadPoints) == 0 || count($quadPoints) % 8 != 0) {
131  #require_once 'Zend/Pdf/Exception.php';
132  throw new Zend_Pdf_Exception('$quadPoints parameter must be an array of 8xN numbers');
133  }
134  $points = new Zend_Pdf_Element_Array();
135  foreach ($quadPoints as $quadPoint) {
136  $points->items[] = new Zend_Pdf_Element_Numeric($quadPoint);
137  }
138  $annotationDictionary->QuadPoints = $points;
139 
140  return new Zend_Pdf_Annotation_Markup($annotationDictionary);
141  }
142 }
const TYPE_NAME
Definition: Element.php:35
static create($x1, $y1, $x2, $y2, $text, $subType, $quadPoints)
Definition: Markup.php:114
__construct(Zend_Pdf_Element $annotationDictionary)
Definition: Markup.php:58
endifif( $block->getLastPageNum()>1)( 'Page') ?></strong >< ul class $text
Definition: pager.phtml:43
const TYPE_DICTIONARY
Definition: Element.php:37