Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Canvas.php
Go to the documentation of this file.
1 <?php
22 #require_once 'Zend/Pdf/Canvas/Abstract.php';
23 
33 {
41  protected $_procSet = array();
42 
48  protected $_width;
49 
55  protected $_height;
56 
57  protected $_resources = array('Font' => array(),
58  'XObject' => array(),
59  'ExtGState' => array());
60 
67  public function __construct($width, $height)
68  {
69  $this->_width = $width;
70  $this->_height = $height;
71  }
72 
78  protected function _addProcSet($procSetName)
79  {
80  $this->_procset[$procSetName] = 1;
81  }
82 
96  {
97  // Check, that resource is already attached to resource set.
98  $resObject = $resource->getResource();
99  foreach ($this->_resources[$type] as $resName => $collectedResObject) {
100  if ($collectedResObject === $resObject) {
101  return $resName;
102  }
103  }
104 
105  $idCounter = 1;
106  do {
107  $newResName = $type[0] . $idCounter++;
108  } while (isset($this->_resources[$type][$newResName]));
109 
110  $this->_resources[$type][$newResName] = $resObject;
111 
112  return $newResName;
113  }
114 
144  public function getResources()
145  {
146  $this->_resources['ProcSet'] = array_keys($this->_procSet);
147  return $this->_resources;
148  }
149 
158  public function getContents()
159  {
161  }
162 
168  public function getHeight()
169  {
170  return $this->_height;
171  }
172 
178  public function getWidth()
179  {
180  return $this->_width;
181  }
182 }
$resource
Definition: bulk.php:12
__construct($width, $height)
Definition: Canvas.php:67
$type
Definition: item.phtml:13
_attachResource($type, Zend_Pdf_Resource $resource)
Definition: Canvas.php:95
_addProcSet($procSetName)
Definition: Canvas.php:78