Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Zend_Pdf_Element_Object_Stream Class Reference
Inheritance diagram for Zend_Pdf_Element_Object_Stream:
Zend_Pdf_Element_Object Zend_Pdf_Element

Public Member Functions

 __construct ($val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory, $dictionary=null)
 
 __get ($property)
 
 __set ($property, $value)
 
 skipFilters ()
 
 __call ($method, $args)
 
 makeClone (Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
 
 dump (Zend_Pdf_ElementFactory $factory)
 
 cleanUp ()
 
- Public Member Functions inherited from Zend_Pdf_Element_Object
 __construct (Zend_Pdf_Element $val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory)
 
 getFactory ()
 
 getType ()
 
 getObjNum ()
 
 getGenNum ()
 
 toString ($factory=null)
 
 dump (Zend_Pdf_ElementFactory $factory)
 
 __get ($property)
 
 __set ($property, $value)
 
 __call ($method, $args)
 
 makeClone (Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
 
 touch ()
 
 getObject ()
 
 cleanUp ()
 
 toPhp ()
 
- Public Member Functions inherited from Zend_Pdf_Element
 getType ()
 
 toString ($factory=null)
 
 makeClone (Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
 
 setParentObject (Zend_Pdf_Element_Object $parent)
 
 getParentObject ()
 
 touch ()
 
 cleanUp ()
 
 toPhp ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Pdf_Element
static phpToPdf ($input)
 
- Data Fields inherited from Zend_Pdf_Element
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
 
- Protected Attributes inherited from Zend_Pdf_Element_Object
 $_value
 
 $_objNum
 
 $_genNum
 
 $_factory
 

Detailed Description

Definition at line 40 of file Stream.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $val,
  $objNum,
  $genNum,
Zend_Pdf_ElementFactory  $factory,
  $dictionary = null 
)

Object constructor

Parameters
mixed$val
integer$objNum
integer$genNum
Zend_Pdf_ElementFactory$factory
Zend_Pdf_Element_Dictionary | null$dictionary
Exceptions
Zend_Pdf_Exception

Definition at line 78 of file Stream.php.

79  {
80  parent::__construct(new Zend_Pdf_Element_Stream($val), $objNum, $genNum, $factory);
81 
82  if ($dictionary === null) {
83  $this->_dictionary = new Zend_Pdf_Element_Dictionary();
84  $this->_dictionary->Length = new Zend_Pdf_Element_Numeric(strlen( $val ));
85  $this->_streamDecoded = true;
86  } else {
87  $this->_dictionary = $dictionary;
88  $this->_streamDecoded = false;
89  }
90  }

Member Function Documentation

◆ __call()

__call (   $method,
  $args 
)

Call handler

Parameters
string$method
array$args
Returns
mixed

Definition at line 362 of file Stream.php.

363  {
364  if (!$this->_streamDecoded) {
365  $this->_decodeStream();
366  }
367 
368  switch (count($args)) {
369  case 0:
370  return $this->_value->$method();
371  case 1:
372  return $this->_value->$method($args[0]);
373  default:
374  #require_once 'Zend/Pdf/Exception.php';
375  throw new Zend_Pdf_Exception('Unsupported number of arguments');
376  }
377  }

◆ __get()

__get (   $property)

Get handler

Parameters
string$property
Returns
mixed
Exceptions
Zend_Pdf_Exception

If stream is not decoded yet, then store original decoding options (do it only once).

Definition at line 297 of file Stream.php.

298  {
299  if ($property == 'dictionary') {
303  if (( !$this->_streamDecoded ) && ($this->_initialDictionaryData === null)) {
304  $this->_initialDictionaryData = $this->_extractDictionaryData();
305  }
306 
307  return $this->_dictionary;
308  }
309 
310  if ($property == 'value') {
311  if (!$this->_streamDecoded) {
312  $this->_decodeStream();
313  }
314 
315  return $this->_value->value->getRef();
316  }
317 
318  #require_once 'Zend/Pdf/Exception.php';
319  throw new Zend_Pdf_Exception('Unknown stream object property requested.');
320  }

◆ __set()

__set (   $property,
  $value 
)

Set handler

Parameters
string$property
mixed$value

Definition at line 329 of file Stream.php.

330  {
331  if ($property == 'value') {
332  $valueRef = &$this->_value->value->getRef();
333  $valueRef = $value;
334  $this->_value->value->touch();
335 
336  $this->_streamDecoded = true;
337 
338  return;
339  }
340 
341  #require_once 'Zend/Pdf/Exception.php';
342  throw new Zend_Pdf_Exception('Unknown stream object property: \'' . $property . '\'.');
343  }
$value
Definition: gender.phtml:16

◆ cleanUp()

cleanUp ( )

Clean up resources, used by object

Definition at line 448 of file Stream.php.

449  {
450  $this->_dictionary = null;
451  $this->_value = null;
452  }

◆ dump()

dump ( Zend_Pdf_ElementFactory  $factory)

Dump object to a string to save within PDF file

$factory parameter defines operation context.

Parameters
Zend_Pdf_ElementFactory$factory
Returns
string

Definition at line 419 of file Stream.php.

420  {
421  $shift = $factory->getEnumerationShift($this->_factory);
422 
423  if ($this->_streamDecoded) {
424  $this->_initialDictionaryData = $this->_extractDictionaryData();
425  $this->_encodeStream();
426  } else if ($this->_initialDictionaryData != null) {
427  $newDictionary = $this->_extractDictionaryData();
428 
429  if ($this->_initialDictionaryData !== $newDictionary) {
430  $this->_decodeStream();
431  $this->_initialDictionaryData = $newDictionary;
432  $this->_encodeStream();
433  }
434  }
435 
436  // Update stream length
437  $this->dictionary->Length->value = $this->_value->length();
438 
439  return $this->_objNum + $shift . " " . $this->_genNum . " obj \n"
440  . $this->dictionary->toString($factory) . "\n"
441  . $this->_value->toString($factory) . "\n"
442  . "endobj\n";
443  }

◆ makeClone()

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

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

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 387 of file Stream.php.

388  {
389  $id = spl_object_hash($this);
390  if (isset($processed[$id])) {
391  // Do nothing if object is already processed
392  // return it
393  return $processed[$id];
394  }
395 
396  $streamValue = $this->_value;
397  $streamDictionary = $this->_dictionary->makeClone($factory, $processed, $mode);
398 
399  // Make new empty instance of stream object and register it in $processed container
400  $processed[$id] = $clonedObject = $factory->newStreamObject('');
401 
402  // Copy current object data and state
403  $clonedObject->_dictionary = $this->_dictionary->makeClone($factory, $processed, $mode);
404  $clonedObject->_value = $this->_value->makeClone($factory, $processed, $mode);
405  $clonedObject->_initialDictionaryData = $this->_initialDictionaryData;
406  $clonedObject->_streamDecoded = $this->_streamDecoded;
407 
408  return $clonedObject;
409  }
$id
Definition: fieldset.phtml:14
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15

◆ skipFilters()

skipFilters ( )

Treat stream data as already encoded

Definition at line 349 of file Stream.php.

350  {
351  $this->_streamDecoded = false;
352  }

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