Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Data Fields
Zend_Pdf_Element Class Reference
Inheritance diagram for Zend_Pdf_Element:
Zend_Pdf_Element_Array Zend_Pdf_Element_Boolean Zend_Pdf_Element_Dictionary Zend_Pdf_Element_Name Zend_Pdf_Element_Null Zend_Pdf_Element_Numeric Zend_Pdf_Element_Object Zend_Pdf_Element_Reference Zend_Pdf_Element_Stream Zend_Pdf_Element_String

Public Member Functions

 getType ()
 
 toString ($factory=null)
 
 makeClone (Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
 
 setParentObject (Zend_Pdf_Element_Object $parent)
 
 getParentObject ()
 
 touch ()
 
 cleanUp ()
 
 toPhp ()
 

Static Public Member Functions

static phpToPdf ($input)
 

Data Fields

const TYPE_BOOL = 1
 
const TYPE_NUMERIC = 2
 
const TYPE_STRING = 3
 
const TYPE_NAME = 4
 
const TYPE_ARRAY = 5
 
const TYPE_DICTIONARY = 6
 
const TYPE_STREAM = 7
 
const TYPE_NULL = 11
 
const CLONE_MODE_SKIP_PAGES = 1
 
const CLONE_MODE_FORCE_CLONING = 2
 

Detailed Description

Definition at line 30 of file Element.php.

Member Function Documentation

◆ cleanUp()

cleanUp ( )

Clean up resources, used by object

Definition at line 124 of file Element.php.

125  {
126  // Do nothing
127  }

◆ getParentObject()

getParentObject ( )

Get top level parent indirect object.

Returns
Zend_Pdf_Element_Object

Definition at line 102 of file Element.php.

103  {
104  return $this->_parentObject;
105  }

◆ getType()

getType ( )
abstract

Return type of the element. See ZPdfPDFConst for possible values

Returns
integer

◆ makeClone()

makeClone ( Zend_Pdf_ElementFactory  $factory,
array &  $processed,
  $mode 
)

Detach PDF object from the factory (if applicable), clone it and attach to new factory.

Todo:
It's nevessry to check if SplObjectStorage class works faster (Needs PHP 5.3.x to attach object with additional data to storage)
Parameters
Zend_Pdf_ElementFactory$factoryThe factory to attach
array&$processedList of already processed indirect objects, used to avoid objects duplication
integer$modeCloning mode (defines filter for objects cloning)
Returns
Zend_Pdf_Element

Definition at line 81 of file Element.php.

82  {
83  return clone $this;
84  }

◆ phpToPdf()

static phpToPdf (   $input)
static

Convert PHP value into PDF element.

Parameters
mixed$input
Returns
Zend_Pdf_Element

Definition at line 145 of file Element.php.

146  {
147  if (is_numeric($input)) {
148  #require_once 'Zend/Pdf/Element/Numeric.php';
149  return new Zend_Pdf_Element_Numeric($input);
150  } else if (is_bool($input)) {
151  #require_once 'Zend/Pdf/Element/Boolean.php';
152  return new Zend_Pdf_Element_Boolean($input);
153  } else if (is_array($input)) {
154  $pdfElementsArray = array();
155  $isDictionary = false;
156 
157  foreach ($input as $key => $value) {
158  if (is_string($key)) {
159  $isDictionary = true;
160  }
161  $pdfElementsArray[$key] = Zend_Pdf_Element::phpToPdf($value);
162  }
163 
164  if ($isDictionary) {
165  #require_once 'Zend/Pdf/Element/Dictionary.php';
166  return new Zend_Pdf_Element_Dictionary($pdfElementsArray);
167  } else {
168  #require_once 'Zend/Pdf/Element/Array.php';
169  return new Zend_Pdf_Element_Array($pdfElementsArray);
170  }
171  } else {
172  #require_once 'Zend/Pdf/Element/String.php';
173  return new Zend_Pdf_Element_String((string)$input);
174  }
175  }
static phpToPdf($input)
Definition: Element.php:145
$value
Definition: gender.phtml:16

◆ setParentObject()

setParentObject ( Zend_Pdf_Element_Object  $parent)

Set top level parent indirect object.

Parameters
Zend_Pdf_Element_Object$parent

Definition at line 91 of file Element.php.

92  {
93  $this->_parentObject = $parent;
94  }

◆ toPhp()

toPhp ( )

Convert PDF element to PHP type.

Returns
mixed

Definition at line 134 of file Element.php.

135  {
136  return $this->value;
137  }
$value
Definition: gender.phtml:16

◆ toString()

toString (   $factory = null)
abstract

Convert element to a string, which can be directly written to a PDF file.

$factory parameter defines operation context.

Parameters
Zend_Pdf_Factory$factory
Returns
string

◆ touch()

touch ( )

Mark object as modified, to include it into new PDF file segment.

We don't automate this action to keep control on PDF update process. All new objects are treated as "modified" automatically.

Definition at line 114 of file Element.php.

115  {
116  if ($this->_parentObject !== null) {
117  $this->_parentObject->touch();
118  }
119  }

Field Documentation

◆ CLONE_MODE_FORCE_CLONING

const CLONE_MODE_FORCE_CLONING = 2

Definition at line 68 of file Element.php.

◆ CLONE_MODE_SKIP_PAGES

const CLONE_MODE_SKIP_PAGES = 1

Definition at line 67 of file Element.php.

◆ TYPE_ARRAY

const TYPE_ARRAY = 5

Definition at line 36 of file Element.php.

◆ TYPE_BOOL

const TYPE_BOOL = 1

Definition at line 32 of file Element.php.

◆ TYPE_DICTIONARY

const TYPE_DICTIONARY = 6

Definition at line 37 of file Element.php.

◆ TYPE_NAME

const TYPE_NAME = 4

Definition at line 35 of file Element.php.

◆ TYPE_NULL

const TYPE_NULL = 11

Definition at line 39 of file Element.php.

◆ TYPE_NUMERIC

const TYPE_NUMERIC = 2

Definition at line 33 of file Element.php.

◆ TYPE_STREAM

const TYPE_STREAM = 7

Definition at line 38 of file Element.php.

◆ TYPE_STRING

const TYPE_STRING = 3

Definition at line 34 of file Element.php.


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