public
|
#
__construct( string $size = self::SIZE_A4, float $unitConversion = SimplePdf\Page::UNITS_CENTIMETER )
Create a new PDF page, with A4 size and default font Helvetica, size 12
Create a new PDF page, with A4 size and default font Helvetica, size 12
Parameters
- $size
string $size page size (see \ZendPdf\Page), default A4 size
- $unitConversion
float $unitConversion conversion factor for custom units, default
self::UNITS_CENTIMETER
|
public
float
|
#
getUnitConversion( )
Get the current conversion factor to convert from/to native units
(points)
Get the current conversion factor to convert from/to native units
(points)
Returns
float current conversion factor
|
public
|
#
setUnitConversion( float $unitConversion )
Sets the conversion factor to use to convert from/to native units
(points)
Sets the conversion factor to use to convert from/to native units
(points)
Parameters
- $unitConversion
float $unitConversion new conversion factor
|
public
|
#
convertToPoints( float & $number )
Convert a value in the given units to points
Convert a value in the given units to points
Parameters
- $number
float &$number number (in the given units) to convert, BY REF
|
public
|
#
convertFromPoints( float & $number )
Convert a value in points to the given units
Convert a value in points to the given units
Parameters
- $number
float &$number number (in points) to convert, BY REF
|
public
|
#
convertCoordinatesFromUserSpace( float & $x, float & $y )
Convert (x,y)-coordinates in the user space (top to bottom, in the given
units, relative to the margins) to native geometry (points, bottom to top)
Convert (x,y)-coordinates in the user space (top to bottom, in the given
units, relative to the margins) to native geometry (points, bottom to top)
Parameters
- $x
float &$x x-coordinate (in the given units, from the left margin) to convert, BY
REF
- $y
float &$y y-coordinate (in the given units, from the top margin) to convert, BY
REF
|
public
|
#
convertCoordinatesToUserSpace( float & $x, float & $y )
Convert (x,y)-coordinates in native geometry (points, bottom to top) to the
user space (top to bottom, in the given units, relative to the margins)
Convert (x,y)-coordinates in native geometry (points, bottom to top) to the
user space (top to bottom, in the given units, relative to the margins)
Parameters
- $x
float &$x x-coordinate (in points, from the left) to convert, BY REF
- $y
float &$y y-coordinate (in points, from the bottom) to convert, BY REF
|
public
float
|
#
getLineSpacing( )
Get the current line spacing
Get the current line spacing
Returns
float line spacing value, 1.0 being 'normal' distance
|
public
|
#
setLineSpacing( float $lineSpacing )
Sets the line spacing to use for future writeText() / writeLine() calls
Sets the line spacing to use for future writeText() / writeLine() calls
Parameters
- $lineSpacing
float $lineSpacing new line spacing value to use, 1.0 being 'normal' distance
|
public
float
|
#
getLeftMargin( )
Get the left margin of the page, in the given units
Get the left margin of the page, in the given units
Returns
float left page margin, in the given units
|
public
|
#
setLeftMargin( float $margin )
Set a new left margin, in the given units
Set a new left margin, in the given units
Parameters
- $margin
float $margin new left margin, in the given units
|
public
float
|
#
getRightMargin( )
Get the right margin of the page, in the given units
Get the right margin of the page, in the given units
Returns
float right page margin, in the given units
|
public
|
#
setRightMargin( float $margin )
Set a new right margin, in the given units
Set a new right margin, in the given units
Parameters
- $margin
float $margin new right margin, in the given units
|
public
float
|
#
getTopMargin( )
Get the top margin of the page, in the given units
Get the top margin of the page, in the given units
Returns
float top page margin, in the given units
|
public
|
#
setTopMargin( float $margin )
Set a new top margin, in the given units
Set a new top margin, in the given units
Parameters
- $margin
float $margin new top margin, in the given units
|
public
float
|
#
getBottomMargin( )
Get the bottom margin of the page, in the given units
Get the bottom margin of the page, in the given units
Returns
float bottom page margin, in the given units
|
public
|
#
setBottomMargin( float $margin )
Set a new bottom margin, in the given units
Set a new bottom margin, in the given units
Parameters
- $margin
float $margin new bottom margin, in the given units
|
public
|
#
setMargins( float $marginLeft, float $marginRight, float $marginTop, float $marginBottom )
Set new margin, in the given units
Set new margin, in the given units
Parameters
- $marginLeft
float $marginLeft new left margin, in the given units
- $marginRight
float $marginRight new right margin, in the given units
- $marginTop
float $marginTop new top margin, in the given units
- $marginBottom
float $marginBottom new bottom margin, in the given units
|
public
|
#
setAllMargins( float $margin )
Set a new margin for all sides, in the given units
Set a new margin for all sides, in the given units
Parameters
- $margin
float $margin new margin to set on all sides, in the given units
|
public
float
|
#
getWidth( )
Get page width in the given units
Get page width in the given units
Returns
float width of the page in the given units
|
public
float
|
#
getInnerWidth( )
Get the width (in the given units) of the page area excluding the set margins
(if any)
Get the width (in the given units) of the page area excluding the set margins
(if any)
Returns
float page width in the given units, excluding margins
|
public
float
|
#
getHeight( )
Get page height in the given units
Get page height in the given units
Returns
float height of the page in the given units
|
public
float
|
#
getInnerHeight( )
Get the height (in the given units) of the page area excluding the set
margins (if any)
Get the height (in the given units) of the page area excluding the set
margins (if any)
Returns
float page height in the given units, excluding margins
|
public
|
#
setFont( ZendPdf\Resource\Font\AbstractFont $font, float $fontSize = null )
Sets a new font family and, optionally, a new font size as well
Sets a new font family and, optionally, a new font size as well
Parameters
- $font
ZendPdf\Resource\Font\AbstractFont $font font object to use
- $fontSize
float $fontSize new font size, leave it out to keep the current font size
|
public
|
#
setFontSize( float $fontSize )
Change the font size, without changing the font family
Change the font size, without changing the font family
Parameters
- $fontSize
float $fontSize new font size to use
|
public
|
#
drawLine( float $x1, float $y1, float $x2, float $y2 )
Draw a line from 1 point to another
Draw a line from 1 point to another
Parameters
- $x1
float $x1 x-coordinate (in the given units) of the point from where to draw the line
- $y1
float $y1 y-coordinate (in the given units) of the point from where to draw the line
- $x2
float $x2 x-coordinate (in the given units) of the point to where to draw the line
- $y2
float $y2 y-coordinate (in the given units) of the point to where to draw the line
|
public
|
#
writeText( float $x, float $y, string $text, float $anchorPoint = SimplePdf\Page::TEXT_ALIGN_LEFT , float $wrapWidth = 0 )
Write a (multiline / optionally wrapping) text to the page
Write a (multiline / optionally wrapping) text to the page
Parameters
- $x
float $x x-coordinate (in the given units) of the anchor point of the text
- $y
float $y y-coordinate (in the given units) of the anchor point of the text
- $text
string $text text to write to the PDF (can contain newlines)
- $anchorPoint
float $anchorPoint horizontal position (0..1) to anchor each line, defaults to
self::TEXT_ALIGN_LEFT
- $wrapWidth
float $wrapWidth width (in the given units) to wrap text at, or leave out for no
wrapping
|
public
|
#
writeLine( float $x, float $y, string $line )
Write a single line of text to the page
Write a single line of text to the page
Parameters
- $x
float $x x-coordinate (in the given units) of the top-left corner where the text
should start
- $y
float $y y-coordinate (in the given units) of the top-left corner where the text
should start
- $line
string $line line to write to the page, should not contain newlines (and will NOT be
wrapped)
|
public
string
|
#
wordWrapText( string $text, string $wrapWidth )
Word-wrap a text to a certain width, using the current font properties
Word-wrap a text to a certain width, using the current font properties
Parameters
- $text
string $text text to wrap (can already contain some newlines)
- $wrapWidth
string $wrapWidth width (in the given units) to wrap the text to
Returns
string the same text but with newlines inserted at the specified $wrapWidth
|
public
float
|
#
getLineHeight( )
Get the line height (the offset between consecutive lines)
Get the line height (the offset between consecutive lines)
Returns
float distance between consecutive lines in the given units
|
public
float
|
#
getTextWidth( string $text )
Calculates how much (horizontal) space a text would use if written to the
page, using the current font properties
Calculates how much (horizontal) space a text would use if written to the
page, using the current font properties
Parameters
- $text
string $text text to calculate the width for (should not contain newlines)
Returns
float width (in the given units) that the text would use if written to the page
|