Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Zend_Pdf_Canvas Class Reference
Inheritance diagram for Zend_Pdf_Canvas:
Zend_Pdf_Canvas_Abstract Zend_Pdf_Canvas_Interface

Public Member Functions

 __construct ($width, $height)
 
 getResources ()
 
 getContents ()
 
 getHeight ()
 
 getWidth ()
 
- Public Member Functions inherited from Zend_Pdf_Canvas_Abstract
 drawCanvas (Zend_Pdf_Canvas_Interface $canvas, $x1, $y1, $x2=null, $y2=null)
 
 setFillColor (Zend_Pdf_Color $color)
 
 setLineColor (Zend_Pdf_Color $color)
 
 setLineWidth ($width)
 
 setLineDashingPattern ($pattern, $phase=0)
 
 setFont (Zend_Pdf_Resource_Font $font, $fontSize)
 
 setStyle (Zend_Pdf_Style $style)
 
 getFont ()
 
 getFontSize ()
 
 getStyle ()
 
 saveGS ()
 
 restoreGS ()
 
 setAlpha ($alpha, $mode='Normal')
 
 clipCircle ($x, $y, $radius, $startAngle=null, $endAngle=null)
 
 clipEllipse ($x1, $y1, $x2, $y2, $startAngle=null, $endAngle=null)
 
 clipPolygon ($x, $y, $fillMethod=Zend_Pdf_Page::FILL_METHOD_NON_ZERO_WINDING)
 
 clipRectangle ($x1, $y1, $x2, $y2)
 
 drawCircle ($x, $y, $radius, $param4=null, $param5=null, $param6=null)
 
 drawEllipse ($x1, $y1, $x2, $y2, $param5=null, $param6=null, $param7=null)
 
 drawImage (Zend_Pdf_Resource_Image $image, $x1, $y1, $x2, $y2)
 
 drawLayoutBox ($box, $x, $y)
 
 drawLine ($x1, $y1, $x2, $y2)
 
 drawPolygon ($x, $y, $fillType=Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE, $fillMethod=Zend_Pdf_Page::FILL_METHOD_NON_ZERO_WINDING)
 
 drawRectangle ($x1, $y1, $x2, $y2, $fillType=Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE)
 
 drawRoundedRectangle ($x1, $y1, $x2, $y2, $radius, $fillType=Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE)
 
 drawText ($text, $x, $y, $charEncoding='')
 
 pathClose ()
 
 pathLine ($x, $y)
 
 pathMove ($x, $y)
 
 rotate ($x, $y, $angle)
 
 scale ($xScale, $yScale)
 
 translate ($xShift, $yShift)
 
 skew ($x, $y, $xAngle, $yAngle)
 
 rawWrite ($data, $procSet=null)
 

Protected Member Functions

 _addProcSet ($procSetName)
 
 _attachResource ($type, Zend_Pdf_Resource $resource)
 
- Protected Member Functions inherited from Zend_Pdf_Canvas_Abstract
 _addProcSet ($procSetName)
 
 _attachResource ($type, Zend_Pdf_Resource $resource)
 

Protected Attributes

 $_procSet = array()
 
 $_width
 
 $_height
 
 $_resources
 
- Protected Attributes inherited from Zend_Pdf_Canvas_Abstract
 $_contents = ''
 
 $_font = null
 
 $_fontSize
 
 $_style = null
 
 $_saveCount = 0
 

Detailed Description

Definition at line 32 of file Canvas.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $width,
  $height 
)

Object constructor

Parameters
float$width
float$height

Definition at line 67 of file Canvas.php.

68  {
69  $this->_width = $width;
70  $this->_height = $height;
71  }

Member Function Documentation

◆ _addProcSet()

_addProcSet (   $procSetName)
protected

Add procedure set to the canvas description

Parameters
string$procSetName

Definition at line 78 of file Canvas.php.

79  {
80  $this->_procset[$procSetName] = 1;
81  }

◆ _attachResource()

_attachResource (   $type,
Zend_Pdf_Resource  $resource 
)
protected

Attach resource to the canvas

Method returns a name of the resource which can be used as a resource reference within drawing instructions stream Allowed types: 'ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font', 'Properties'

Parameters
string$type
Zend_Pdf_Resource$resource
Returns
string

Definition at line 95 of file Canvas.php.

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  }
$resource
Definition: bulk.php:12
$type
Definition: item.phtml:13

◆ getContents()

getContents ( )

Get drawing instructions stream

It has to be returned as a PDF stream object to make it reusable.

Todo:
implementation

Implements Zend_Pdf_Canvas_Interface.

Definition at line 158 of file Canvas.php.

159  {
161  }

◆ getHeight()

getHeight ( )

Return the height of this page in points.

Returns
float

Implements Zend_Pdf_Canvas_Interface.

Definition at line 168 of file Canvas.php.

169  {
170  return $this->_height;
171  }

◆ getResources()

getResources ( )

Returns dictionaries of used resources.

Used for canvas implementations interoperability

Structure of the returned array: array( <resTypeName> => array( <resName> => <Zend_Pdf_Resource object>="">, <resName> => <Zend_Pdf_Resource object>="">, <resName> => <Zend_Pdf_Resource object>="">, ... ), <resTypeName> => array( <resName> => <Zend_Pdf_Resource object>="">, <resName> => <Zend_Pdf_Resource object>="">, <resName> => <Zend_Pdf_Resource object>="">, ... ), ... 'ProcSet' => array() )

where ProcSet array is a list of used procedure sets names (strings). Allowed procedure set names: 'PDF', 'Text', 'ImageB', 'ImageC', 'ImageI'

Implements Zend_Pdf_Canvas_Interface.

Definition at line 144 of file Canvas.php.

145  {
146  $this->_resources['ProcSet'] = array_keys($this->_procSet);
147  return $this->_resources;
148  }

◆ getWidth()

getWidth ( )

Return the width of this page in points.

Returns
float

Implements Zend_Pdf_Canvas_Interface.

Definition at line 178 of file Canvas.php.

179  {
180  return $this->_width;
181  }

Field Documentation

◆ $_height

$_height
protected

Definition at line 55 of file Canvas.php.

◆ $_procSet

$_procSet = array()
protected

Definition at line 41 of file Canvas.php.

◆ $_resources

$_resources
protected
Initial value:
= array('Font' => array(),
'XObject' => array(),
'ExtGState' => array())

Definition at line 57 of file Canvas.php.

◆ $_width

$_width
protected

Definition at line 48 of file Canvas.php.


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