package |
Zend_Pdf |
copyright |
Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license |
New BSD License |
inherited_from |
\Zend_Pdf_Canvas_Abstract |
Methods
Clone page, extract it and dependent objects from the current document,
so it can be used within other docs.
__clone()
Object constructor.
__construct(mixed $param1, mixed $param2 = null
, mixed $param3 = null
)
Constructor signatures:
-
Load PDF page from a parsed PDF file.
Object factory is created by PDF parser.
new Zend_Pdf_Page(Zend_Pdf_Element_Dictionary $pageDict,
Zend_Pdf_ElementFactory_Interface $factory);
-
Make a copy of the PDF page.
New page is created in the same context as source page. Object factory is shared.
Thus it will be attached to the document, but need to be placed into Zend_Pdf::$pages array
to be included into output.
new Zend_Pdf_Page(Zend_Pdf_Page $page);
-
Create new page with a specified pagesize.
If $factory is null then it will be created and page must be attached to the document to be
included into output.
new Zend_Pdf_Page(string $pagesize, Zend_Pdf_ElementFactory_Interface $factory = null);
-
Create new page with a specified pagesize (in default user space units).
If $factory is null then it will be created and page must be attached to the document to be
included into output.
new Zend_Pdf_Page(numeric $width, numeric $height, Zend_Pdf_ElementFactory_Interface $factory = null);
Parameters
$param1
mixed
$param2
mixed
$param3
mixed
Exceptions
attachAnnotation()
attachAnnotation(\Zend_Pdf_Annotation $annotation) : \Zend_Pdf_Page
Parameters
$annotation
\Zend_Pdf_Annotation
Returns
\Zend_Pdf_Page
Intersect current clipping area with a circle.
clipCircle(float $x, float $y, float $radius, float $startAngle = null
, float $endAngle = null
) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::clipCircle() |
Parameters
$x
float
$y
float
$radius
float
$startAngle
float
$endAngle
float
Returns
\Zend_Pdf_Canvas_Interface
Intersect current clipping area with a polygon.
clipEllipse(float $x1, float $y1, float $x2, float $y2, float $startAngle = null
, float $endAngle = null
) : \Zend_Pdf_Canvas_Interface
Inherited
Method signatures:
drawEllipse($x1, $y1, $x2, $y2);
drawEllipse($x1, $y1, $x2, $y2, $startAngle, $endAngle);
todo |
process special cases with $x2-$x1 == 0 or $y2-$y1 == 0 |
inherited_from |
\Zend_Pdf_Canvas_Interface::clipEllipse() |
Parameters
$x1
float
$y1
float
$x2
float
$y2
float
$startAngle
float
$endAngle
float
Returns
\Zend_Pdf_Canvas_Interface
Intersect current clipping area with a polygon.
clipPolygon(array $x, array $y, integer $fillMethod = \Zend_Pdf_Page::FILL_METHOD_NON_ZERO_WINDING
) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::clipPolygon() |
Parameters
$x
array
- array of float (the X co-ordinates of the vertices)
$y
array
- array of float (the Y co-ordinates of the vertices)
$fillMethod
integer
Returns
\Zend_Pdf_Canvas_Interface
Intersect current clipping area with a rectangle.
clipRectangle(float $x1, float $y1, float $x2, float $y2) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::clipRectangle() |
Parameters
$x1
float
$y1
float
$x2
float
$y2
float
Returns
\Zend_Pdf_Canvas_Interface
Draw a canvas at the specified location
drawCanvas(\Zend_Pdf_Canvas_Interface $canvas, float $x1, float $y1, float $x2 = null
, float $y2 = null
) : \Zend_Pdf_Canvas_Interface
Inherited
If upper right corner is not specified then canvas heght and width
are used.
inherited_from |
\Zend_Pdf_Canvas_Interface::drawCanvas() |
Parameters
$canvas
\Zend_Pdf_Canvas_Interface
$x1
float
$y1
float
$x2
float
$y2
float
Returns
\Zend_Pdf_Canvas_Interface
Draw a circle centered on x, y with a radius of radius.
drawCircle(float $x, float $y, float $radius, mixed $param4 = null
, mixed $param5 = null
, mixed $param6 = null
) : \Zend_Pdf_Canvas_Interface
Inherited
Method signatures:
drawCircle($x, $y, $radius);
drawCircle($x, $y, $radius, $fillType);
drawCircle($x, $y, $radius, $startAngle, $endAngle);
drawCircle($x, $y, $radius, $startAngle, $endAngle, $fillType);
It's not a really circle, because PDF supports only cubic Bezier curves.
But very good approximation.
It differs from a real circle on a maximum 0.00026 radiuses
(at PI/8, 3PI/8, 5PI/8, 7PI/8, 9PI/8, 11PI/8, 13PI/8 and 15PI/8 angles).
At 0, PI/4, PI/2, 3PI/4, PI, 5PI/4, 3PI/2 and 7*PI/4 it's exactly a tangent to a circle.
inherited_from |
\Zend_Pdf_Canvas_Interface::drawCircle() |
Parameters
$x
float
$y
float
$radius
float
$param4
mixed
$param5
mixed
$param6
mixed
Returns
\Zend_Pdf_Canvas_Interface
Draw an ellipse inside the specified rectangle.
drawEllipse(float $x1, float $y1, float $x2, float $y2, mixed $param5 = null
, mixed $param6 = null
, mixed $param7 = null
) : \Zend_Pdf_Canvas_Interface
Inherited
Method signatures:
drawEllipse($x1, $y1, $x2, $y2);
drawEllipse($x1, $y1, $x2, $y2, $fillType);
drawEllipse($x1, $y1, $x2, $y2, $startAngle, $endAngle);
drawEllipse($x1, $y1, $x2, $y2, $startAngle, $endAngle, $fillType);
todo |
process special cases with $x2-$x1 == 0 or $y2-$y1 == 0 |
inherited_from |
\Zend_Pdf_Canvas_Interface::drawEllipse() |
Parameters
$x1
float
$y1
float
$x2
float
$y2
float
$param5
mixed
$param6
mixed
$param7
mixed
Returns
\Zend_Pdf_Canvas_Interface
Draw an image at the specified position on the page.
drawImage(\Zend_Pdf_Image $image, float $x1, float $y1, float $x2, float $y2) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::drawImage() |
Parameters
$image
\Zend_Pdf_Image
$x1
float
$y1
float
$x2
float
$y2
float
Returns
\Zend_Pdf_Canvas_Interface
Draw a line from x1,y1 to x2,y2.
drawLine(float $x1, float $y1, float $x2, float $y2) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::drawLine() |
Parameters
$x1
float
$y1
float
$x2
float
$y2
float
Returns
\Zend_Pdf_Canvas_Interface
Draw a polygon.
drawPolygon(array $x, array $y, integer $fillType = \Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE
, integer $fillMethod = \Zend_Pdf_Page::FILL_METHOD_NON_ZERO_WINDING
) : \Zend_Pdf_Canvas_Interface
Inherited
If $fillType is Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE or
Zend_Pdf_Page::SHAPE_DRAW_FILL, then polygon is automatically closed.
See detailed description of these methods in a PDF documentation
(section 4.4.2 Path painting Operators, Filling)
inherited_from |
\Zend_Pdf_Canvas_Interface::drawPolygon() |
Parameters
$x
array
- array of float (the X co-ordinates of the vertices)
$y
array
- array of float (the Y co-ordinates of the vertices)
$fillType
integer
$fillMethod
integer
Returns
\Zend_Pdf_Canvas_Interface
Draw a rectangle.
drawRectangle(float $x1, float $y1, float $x2, float $y2, integer $fillType = \Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE
) : \Zend_Pdf_Canvas_Interface
Inherited
Fill types:
Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE - fill rectangle and stroke (default)
Zend_Pdf_Page::SHAPE_DRAW_STROKE - stroke rectangle
Zend_Pdf_Page::SHAPE_DRAW_FILL - fill rectangle
inherited_from |
\Zend_Pdf_Canvas_Interface::drawRectangle() |
Parameters
$x1
float
$y1
float
$x2
float
$y2
float
$fillType
integer
Returns
\Zend_Pdf_Canvas_Interface
Draw a rounded rectangle.
drawRoundedRectangle(float $x1, float $y1, float $x2, float $y2, integer|array $radius, integer $fillType = \Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE
) : \Zend_Pdf_Canvas_Interface
Inherited
Fill types:
Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE - fill rectangle and stroke (default)
Zend_Pdf_Page::SHAPE_DRAW_STROKE - stroke rectangle
Zend_Pdf_Page::SHAPE_DRAW_FILL - fill rectangle
radius is an integer representing radius of the four corners, or an array
of four integers representing the radius starting at top left, going
clockwise
inherited_from |
\Zend_Pdf_Canvas_Interface::drawRoundedRectangle() |
Parameters
$x1
float
$y1
float
$x2
float
$y2
float
$radius
integer
array
$fillType
integer
Returns
\Zend_Pdf_Canvas_Interface
Draw a line of text at the specified position.
drawText(string $text, float $x, float $y, string $charEncoding = ''
) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::drawText() |
Parameters
$text
string
$x
float
$y
float
$charEncoding
string
(optional) Character encoding of source text.
Defaults to current locale.
Exceptions
Returns
\Zend_Pdf_Canvas_Interface
Dump current drawing instructions into the content stream.
flush()
todo |
Don't forget to close all current graphics operations (like path drawing) |
Exceptions
Get current font.
getFont() : \Zend_Pdf_Resource_Font
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::getFont() |
Returns
\Zend_Pdf_Resource_Font
$font
Get current font size
getFontSize() : float
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::getFontSize() |
Returns
float
$fontSize
Return the height of this page in points.
getHeight() : float
Return the style, applied to the page.
getStyle() : \Zend_Pdf_Style
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::getStyle() |
Returns
\Zend_Pdf_Style
Return the width of this page in points.
getWidth() : float
Writes the raw data to the page's content stream.
rawWrite(string $data, string $procSet = null
) : \Zend_Pdf_Canvas_Interface
Inherited
Be sure to consult the PDF reference to ensure your syntax is correct. No
attempt is made to ensure the validity of the stream data.
inherited_from |
\Zend_Pdf_Canvas_Interface::rawWrite() |
Parameters
$data
string
$procSet
string
(optional) Name of ProcSet to add.
Returns
\Zend_Pdf_Canvas_Interface
Prepare page to be rendered into PDF.
render(\Zend_Pdf_ElementFactory_Interface $objFactory)
todo |
Don't forget to close all current graphics operations (like path drawing) |
Parameters
$objFactory
\Zend_Pdf_ElementFactory_Interface
Exceptions
Restore the graphics state that was saved with the last call to saveGS().
restoreGS() : \Zend_Pdf_Canvas_Interface
Inherited
Exceptions
\Zend_Pdf_Exception |
- if there is no previously saved state |
Returns
\Zend_Pdf_Canvas_Interface
Rotate the page.
rotate(float $x, float $y, float $angle) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::rotate() |
Parameters
$x
float
- the X co-ordinate of rotation point
$y
float
- the Y co-ordinate of rotation point
Returns
\Zend_Pdf_Canvas_Interface
Save the graphics state of this page.
saveGS() : \Zend_Pdf_Canvas_Interface
Inherited
This takes a snapshot of the currently applied style, position, clipping area and
any rotation/translation/scaling that has been applied.
todo |
check for the open paths |
inherited_from |
\Zend_Pdf_Canvas_Interface::saveGS() |
Exceptions
\Zend_Pdf_Exception |
- if a save is performed with an open path |
Returns
\Zend_Pdf_Canvas_Interface
Scale coordination system.
scale(float $xScale, float $yScale) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::scale() |
Parameters
Returns
\Zend_Pdf_Canvas_Interface
Set the transparancy
setAlpha(float $alpha, string $mode = 'Normal'
) : \Zend_Pdf_Canvas_Interface
Inherited
$alpha == 0 - transparent
$alpha == 1 - opaque
Transparency modes, supported by PDF:
Normal (default), Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight,
SoftLight, Difference, Exclusion
inherited_from |
\Zend_Pdf_Canvas_Interface::setAlpha() |
Parameters
$alpha
float
$mode
string
Returns
\Zend_Pdf_Canvas_Interface
Set fill color.
setFillColor(\Zend_Pdf_Color $color) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::setFillColor() |
Parameters
$color
\Zend_Pdf_Color
Returns
\Zend_Pdf_Canvas_Interface
Set current font.
setFont(\Zend_Pdf_Resource_Font $font, float $fontSize) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::setFont() |
Parameters
$font
\Zend_Pdf_Resource_Font
$fontSize
float
Returns
\Zend_Pdf_Canvas_Interface
Set line color.
setLineColor(\Zend_Pdf_Color $color) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::setLineColor() |
Parameters
$color
\Zend_Pdf_Color
Returns
\Zend_Pdf_Canvas_Interface
Set line dashing pattern
setLineDashingPattern(mixed $pattern, array $phase = 0
) : \Zend_Pdf_Canvas_Interface
Inherited
Pattern is an array of floats: array(on_length, off_length, on_length, off_length, ...)
or Zend_Pdf_Page::LINE_DASHING_SOLID constant
Phase is shift from the beginning of line.
inherited_from |
\Zend_Pdf_Canvas_Interface::setLineDashingPattern() |
Parameters
$pattern
mixed
$phase
array
Returns
\Zend_Pdf_Canvas_Interface
Set line width.
setLineWidth(float $width) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::setLineWidth() |
Parameters
$width
float
Returns
\Zend_Pdf_Canvas_Interface
Set the style to use for future drawing operations on this page
setStyle(\Zend_Pdf_Style $style) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::setStyle() |
Parameters
$style
\Zend_Pdf_Style
Returns
\Zend_Pdf_Canvas_Interface
Translate coordination system.
skew(float $x, float $y, float $xAngle, float $yAngle) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::skew() |
Parameters
$x
float
- the X co-ordinate of axis skew point
$y
float
- the Y co-ordinate of axis skew point
Returns
\Zend_Pdf_Canvas_Interface
Translate coordination system.
translate(float $xShift, float $yShift) : \Zend_Pdf_Canvas_Interface
Inherited
inherited_from |
\Zend_Pdf_Canvas_Interface::translate() |
Parameters
Returns
\Zend_Pdf_Canvas_Interface
Add procedureSet to the Page description
_addProcSet(string $procSetName)
inherited_from |
\Zend_Pdf_Canvas_Abstract::_addProcSet() |
Parameters
$procSetName
string
Add procedureSet to the Page description
_addProcSet(string $procSetName)
Inherited
Parameters
$procSetName
string
Attach resource to the canvas
_attachResource(string $type, \Zend_Pdf_Resource $resource) : string
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'
inherited_from |
\Zend_Pdf_Canvas_Abstract::_attachResource() |
Parameters
$type
string
$resource
\Zend_Pdf_Resource
Returns
string
Attach resource to the canvas
_attachResource(string $type, \Zend_Pdf_Resource $resource) : string
Inherited
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
$type
string
$resource
\Zend_Pdf_Resource
Returns
string
Properties
Flag which signals, that page is created separately from any PDF document or
attached to anyone.
$_attached : boolean
Drawing instructions
$_contents : string
Page dictionary (refers to an inderect Zend_Pdf_Element_Dictionary object).
$_dictionary : \Zend_Pdf_Element_Reference | \Zend_Pdf_Element_Object
Current font
$_font : \Zend_Pdf_Resource_Font
Current font size
$_fontSize : float
PDF objects factory.
$_objFactory : \Zend_Pdf_ElementFactory_Interface
Safe Graphics State semafore
$_safeGS : boolean
If it's false, than we can't be sure Graphics State is restored withing
context of previous contents stream (ex. drawing coordinate system may be rotated).
We should encompass existing content with save/restore GS operators
Counter for the "Save" operations
$_saveCount : integer
Current style
$_style : \Zend_Pdf_Style
Constants
Fill the path using the even-odd rule.
FILL_METHOD_EVEN_ODD = 1
Fill the path using the non-zero winding rule.
FILL_METHOD_NON_ZERO_WINDING = 0
Solid line dash.
LINE_DASHING_SOLID = 0
Fill the path only. Do not stroke.
SHAPE_DRAW_FILL = 1
Fill and stroke the path.
SHAPE_DRAW_FILL_AND_STROKE = 2
Stroke the path only. Do not fill.
SHAPE_DRAW_STROKE = 0
Size representing an A4 page in portrait (tall) orientation.
SIZE_A4 = '595:842:'
Size representing an A4 page in landscape (wide) orientation.
SIZE_A4_LANDSCAPE = '842:595:'
Size representing a US Letter page in portrait (tall) orientation.
SIZE_LETTER = '612:792:'
Size representing a US Letter page in landscape (wide) orientation.
SIZE_LETTER_LANDSCAPE = '792:612:'