Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions
Zend_Pdf_Annotation_Link Class Reference
Inheritance diagram for Zend_Pdf_Annotation_Link:
Zend_Pdf_Annotation

Public Member Functions

 __construct (Zend_Pdf_Element $annotationDictionary)
 
 setDestination ($target)
 
 getDestination ()
 
- Public Member Functions inherited from Zend_Pdf_Annotation
 getResource ()
 
 setBottom ($bottom)
 
 getBottom ()
 
 setTop ($top)
 
 getTop ()
 
 setRight ($right)
 
 getRight ()
 
 setLeft ($left)
 
 getLeft ()
 
 getText ()
 
 setText ($text)
 
 __construct (Zend_Pdf_Element $annotationDictionary)
 

Static Public Member Functions

static create ($x1, $y1, $x2, $y2, $target)
 
- Static Public Member Functions inherited from Zend_Pdf_Annotation
static load (Zend_Pdf_Element $resource)
 

Additional Inherited Members

- Protected Attributes inherited from Zend_Pdf_Annotation
 $_annotationDictionary
 

Detailed Description

Definition at line 46 of file Link.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Zend_Pdf_Element  $annotationDictionary)

Annotation object constructor

Exceptions
Zend_Pdf_Exception

Definition at line 53 of file Link.php.

54  {
55  if ($annotationDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
56  #require_once 'Zend/Pdf/Exception.php';
57  throw new Zend_Pdf_Exception('Annotation dictionary resource has to be a dictionary.');
58  }
59 
60  if ($annotationDictionary->Subtype === null ||
61  $annotationDictionary->Subtype->getType() != Zend_Pdf_Element::TYPE_NAME ||
62  $annotationDictionary->Subtype->value != 'Link') {
63  #require_once 'Zend/Pdf/Exception.php';
64  throw new Zend_Pdf_Exception('Subtype => Link entry is requires');
65  }
66 
67  parent::__construct($annotationDictionary);
68  }
const TYPE_NAME
Definition: Element.php:35
const TYPE_DICTIONARY
Definition: Element.php:37

Member Function Documentation

◆ create()

static create (   $x1,
  $y1,
  $x2,
  $y2,
  $target 
)
static

Create link annotation object

Parameters
float$x1
float$y1
float$x2
float$y2
Zend_Pdf_Target | string$target
Returns
Zend_Pdf_Annotation_Link
Exceptions
Zend_Pdf_Exception

Definition at line 81 of file Link.php.

82  {
83  if (is_string($target)) {
84  #require_once 'Zend/Pdf/Destination/Named.php';
86  }
87  if (!$target instanceof Zend_Pdf_Target) {
88  #require_once 'Zend/Pdf/Exception.php';
89  throw new Zend_Pdf_Exception('$target parameter must be a Zend_Pdf_Target object or a string.');
90  }
91 
92  $annotationDictionary = new Zend_Pdf_Element_Dictionary();
93 
94  $annotationDictionary->Type = new Zend_Pdf_Element_Name('Annot');
95  $annotationDictionary->Subtype = new Zend_Pdf_Element_Name('Link');
96 
97  $rectangle = new Zend_Pdf_Element_Array();
98  $rectangle->items[] = new Zend_Pdf_Element_Numeric($x1);
99  $rectangle->items[] = new Zend_Pdf_Element_Numeric($y1);
100  $rectangle->items[] = new Zend_Pdf_Element_Numeric($x2);
101  $rectangle->items[] = new Zend_Pdf_Element_Numeric($y2);
102  $annotationDictionary->Rect = $rectangle;
103 
104  if ($target instanceof Zend_Pdf_Destination) {
105  $annotationDictionary->Dest = $target->getResource();
106  } else {
107  $annotationDictionary->A = $target->getResource();
108  }
109 
110  return new Zend_Pdf_Annotation_Link($annotationDictionary);
111  }
$target
Definition: skip.phtml:8
static create($name)
Definition: Named.php:76

◆ getDestination()

getDestination ( )

Get link annotation destination

Returns
Zend_Pdf_Target|null

Definition at line 148 of file Link.php.

149  {
150  if ($this->_annotationDictionary->Dest === null &&
151  $this->_annotationDictionary->A === null) {
152  return null;
153  }
154 
155  if ($this->_annotationDictionary->Dest !== null) {
156  #require_once 'Zend/Pdf/Destination.php';
157  return Zend_Pdf_Destination::load($this->_annotationDictionary->Dest);
158  } else {
159  #require_once 'Zend/Pdf/Action.php';
160  return Zend_Pdf_Action::load($this->_annotationDictionary->A);
161  }
162  }
static load(Zend_Pdf_Element $resource)
Definition: Destination.php:49
static load(Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions=null)
Definition: Action.php:115

◆ setDestination()

setDestination (   $target)

Set link annotation destination

Parameters
Zend_Pdf_Target | string$target
Returns
Zend_Pdf_Annotation_Link

Definition at line 119 of file Link.php.

120  {
121  if (is_string($target)) {
122  #require_once 'Zend/Pdf/Destination/Named.php';
124  }
125  if (!$target instanceof Zend_Pdf_Target) {
126  #require_once 'Zend/Pdf/Exception.php';
127  throw new Zend_Pdf_Exception('$target parameter must be a Zend_Pdf_Target object or a string.');
128  }
129 
130  $this->_annotationDictionary->touch();
131  $this->_annotationDictionary->Dest = $destination->getResource();
132  if ($target instanceof Zend_Pdf_Destination) {
133  $this->_annotationDictionary->Dest = $target->getResource();
134  $this->_annotationDictionary->A = null;
135  } else {
136  $this->_annotationDictionary->Dest = null;
137  $this->_annotationDictionary->A = $target->getResource();
138  }
139 
140  return $this;
141  }
$target
Definition: skip.phtml:8
static create($name)
Definition: Named.php:76

The documentation for this class was generated from the following file: