public
|
#
__construct( $orientation = 'P', $unit = 'mm', $format = 'A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false, $pdfa = false )
This is the class constructor.
It allows to set up the page format, the orientation and the measure unit used in all the methods (except for the font sizes).
This is the class constructor.
It allows to set up the page format, the orientation and the measure unit used in all the methods (except for the font sizes).
IMPORTANT: Please note that this method sets the mb_internal_encoding to ASCII, so if you are using the mbstring module functions with TCPDF you need to correctly set/unset the mb_internal_encoding when needed.
Parameters
- $orientation
page orientation. Possible values are (case insensitive):
- P or Portrait (default)
- L or Landscape
- '' (empty string) for automatic orientation
- $unit
User measure unit. Possible values are:
- pt: point
- mm: millimeter (default)
- cm: centimeter
- in: inch
A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
- $format
- The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().
- $unicode
- TRUE means that the input text is unicode (default = true)
- $encoding
- Charset encoding (used only when converting back html entities); default is UTF-8.
- $diskcache
- DEPRECATED FEATURE
- $pdfa
- If TRUE set the document to PDF/A mode.
See
Public
|
public
|
#
__destruct( )
Default destructor.
Since
1.53.0.TC016
Public
|
public
|
#
setPageUnit( $unit )
Set the units of measure for the document.
Set the units of measure for the document.
Parameters
- $unit
User measure unit. Possible values are:
- pt: point
- mm: millimeter (default)
- cm: centimeter
- in: inch
A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
Since
3.0.015 (2008-06-06)
Public
|
protected
|
#
setPageFormat( $format, $orientation = 'P' )
Change the format of the current page
Change the format of the current page
Parameters
- $format
The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() documentation or an array of two numbers (width, height) or an array containing the following measures and options:
- ['format'] = page format name (one of the above);
- ['Rotate'] : The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
- ['PZ'] : The page's preferred zoom (magnification) factor.
- ['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed:
- ['MediaBox']['llx'] : lower-left x coordinate
- ['MediaBox']['lly'] : lower-left y coordinate
- ['MediaBox']['urx'] : upper-right x coordinate
- ['MediaBox']['ury'] : upper-right y coordinate
- ['CropBox'] : the visible region of default user space:
- ['CropBox']['llx'] : lower-left x coordinate
- ['CropBox']['lly'] : lower-left y coordinate
- ['CropBox']['urx'] : upper-right x coordinate
- ['CropBox']['ury'] : upper-right y coordinate
- ['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment:
- ['BleedBox']['llx'] : lower-left x coordinate
- ['BleedBox']['lly'] : lower-left y coordinate
- ['BleedBox']['urx'] : upper-right x coordinate
- ['BleedBox']['ury'] : upper-right y coordinate
- ['TrimBox'] : the intended dimensions of the finished page after trimming:
- ['TrimBox']['llx'] : lower-left x coordinate
- ['TrimBox']['lly'] : lower-left y coordinate
- ['TrimBox']['urx'] : upper-right x coordinate
- ['TrimBox']['ury'] : upper-right y coordinate
- ['ArtBox'] : the extent of the page's meaningful content:
- ['ArtBox']['llx'] : lower-left x coordinate
- ['ArtBox']['lly'] : lower-left y coordinate
- ['ArtBox']['urx'] : upper-right x coordinate
- ['ArtBox']['ury'] : upper-right y coordinate
- ['BoxColorInfo'] :specify the colours and other visual characteristics that should be used in displaying guidelines on the screen for each of the possible page boundaries other than the MediaBox:
- ['BoxColorInfo'][BOXTYPE]['C'] : an array of three numbers in the range 0-255, representing the components in the DeviceRGB colour space.
- ['BoxColorInfo'][BOXTYPE]['W'] : the guideline width in default user units
- ['BoxColorInfo'][BOXTYPE]['S'] : the guideline style: S = Solid; D = Dashed
- ['BoxColorInfo'][BOXTYPE]['D'] : dash array defining a pattern of dashes and gaps to be used in drawing dashed guidelines
- ['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
- ['trans']['Dur'] : The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
- ['trans']['S'] : transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
- ['trans']['D'] : The duration of the transition effect, in seconds.
- ['trans']['Dm'] : (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
- ['trans']['M'] : (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
- ['trans']['Di'] : (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
- ['trans']['SS'] : (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
- ['trans']['B'] : (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
- $orientation
page orientation. Possible values are (case insensitive):
- P or Portrait (default)
- L or Landscape
- '' (empty string) for automatic orientation
Since
3.0.015 (2008-06-06)
See
getPageSizeFromFormat()
Protected
|
public
|
#
setPageOrientation( $orientation, $autopagebreak = '', $bottommargin = '' )
Set page orientation.
Parameters
- $orientation
page orientation. Possible values are (case insensitive):
- P or Portrait (default)
- L or Landscape
- '' (empty string) for automatic orientation
- $autopagebreak
- Boolean indicating if auto-page-break mode should be on or off.
- $bottommargin
- bottom margin of the page.
Since
3.0.015 (2008-06-06)
Public
|
public
|
#
setSpacesRE( $re = '/[^\S\xa0]/' )
Set regular expression to detect withespaces or word separators.
The pattern delimiter must be the forward-slash character "/".
Some example patterns are:
Non-Unicode or missing PCRE unicode support: "/[^\S\xa0]/"
Unicode and PCRE unicode support: "/(?!\xa0)[\s\p{Z}]/u"
Unicode and PCRE unicode support in Chinese mode: "/(?!\xa0)[\s\p{Z}\p{Lo}]/u"
if PCRE unicode support is turned ON ("\P" is the negate class of "\p"):
\s : any whitespace character
\p{Z} : any separator
\p{Lo} : Unicode letter or ideograph that does not have lowercase and uppercase variants. Is used to chunk chinese words.
\xa0 : Unicode Character 'NO-BREAK SPACE' (U+00A0)
Set regular expression to detect withespaces or word separators.
The pattern delimiter must be the forward-slash character "/".
Some example patterns are:
Non-Unicode or missing PCRE unicode support: "/[^\S\xa0]/"
Unicode and PCRE unicode support: "/(?!\xa0)[\s\p{Z}]/u"
Unicode and PCRE unicode support in Chinese mode: "/(?!\xa0)[\s\p{Z}\p{Lo}]/u"
if PCRE unicode support is turned ON ("\P" is the negate class of "\p"):
\s : any whitespace character
\p{Z} : any separator
\p{Lo} : Unicode letter or ideograph that does not have lowercase and uppercase variants. Is used to chunk chinese words.
\xa0 : Unicode Character 'NO-BREAK SPACE' (U+00A0)
Parameters
- $re
- regular expression (leave empty for default).
Since
4.6.016 (2009-06-15)
Public
|
public
|
#
setRTL( $enable, $resetx = true )
Enable or disable Right-To-Left language mode
Enable or disable Right-To-Left language mode
Parameters
- $enable
- if true enable Right-To-Left language mode.
- $resetx
- if true reset the X position on direction change.
Since
2.0.000 (2008-01-03)
Public
|
public
boolean
|
#
getRTL( )
Return the RTL status
Returns
boolean
Since
4.0.012 (2008-07-24)
Public
|
public
|
#
setTempRTL( $mode )
Force temporary RTL language direction
Force temporary RTL language direction
Parameters
- $mode
- can be false, 'L' for LTR or 'R' for RTL
Since
2.1.000 (2008-01-09)
Public
|
public
boolean
|
#
isRTLTextDir( )
Return the current temporary RTL status
Return the current temporary RTL status
Returns
boolean
Since
4.8.014 (2009-11-04)
Public
|
public
|
#
setLastH( $h )
Set the last cell height.
Set the last cell height.
Parameters
Author
Nicola Asuni
Since
1.53.0.TC034
Public
|
public
|
#
getCellHeight( $fontsize, $padding = TRUE )
Return the cell height
Parameters
- $fontsize
- Font size in internal units
- $padding
- If true add cell padding
Public
|
public
|
#
resetLastH( )
Reset the last cell height.
Reset the last cell height.
Since
5.9.000 (2010-10-03)
Public
|
public
last
|
#
getLastH( )
Get the last cell height.
Get the last cell height.
Returns
last cell height
Since
4.0.017 (2008-08-05)
Public
|
public
|
#
setImageScale( $scale )
Set the adjusting factor to convert pixels to user units.
Set the adjusting factor to convert pixels to user units.
Parameters
- $scale
- adjusting factor to convert pixels to user units.
Author
Nicola Asuni
Since
1.5.2
Public
|
public
float
|
#
getImageScale( )
Returns the adjusting factor to convert pixels to user units.
Returns the adjusting factor to convert pixels to user units.
Returns
float adjusting factor to convert pixels to user units.
Author
Nicola Asuni
Since
1.5.2
Public
|
public
array
|
#
getPageDimensions( $pagenum = '' )
Returns an array of page dimensions:
- $this->pagedim[$this->page]['w'] = page width in points
- $this->pagedim[$this->page]['h'] = height in points
- $this->pagedim[$this->page]['wk'] = page width in user units
- $this->pagedim[$this->page]['hk'] = page height in user units
- $this->pagedim[$this->page]['tm'] = top margin
- $this->pagedim[$this->page]['bm'] = bottom margin
- $this->pagedim[$this->page]['lm'] = left margin
- $this->pagedim[$this->page]['rm'] = right margin
- $this->pagedim[$this->page]['pb'] = auto page break
- $this->pagedim[$this->page]['or'] = page orientation
- $this->pagedim[$this->page]['olm'] = original left margin
- $this->pagedim[$this->page]['orm'] = original right margin
- $this->pagedim[$this->page]['Rotate'] = The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
- $this->pagedim[$this->page]['PZ'] = The page's preferred zoom (magnification) factor.
- $this->pagedim[$this->page]['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
- $this->pagedim[$this->page]['trans']['Dur'] = The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
- $this->pagedim[$this->page]['trans']['S'] = transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
- $this->pagedim[$this->page]['trans']['D'] = The duration of the transition effect, in seconds.
- $this->pagedim[$this->page]['trans']['Dm'] = (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
- $this->pagedim[$this->page]['trans']['M'] = (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
- $this->pagedim[$this->page]['trans']['Di'] = (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
- $this->pagedim[$this->page]['trans']['SS'] = (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
- $this->pagedim[$this->page]['trans']['B'] = (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
- $this->pagedim[$this->page]['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed
- $this->pagedim[$this->page]['MediaBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['MediaBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['MediaBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['MediaBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['CropBox'] : the visible region of default user space
- $this->pagedim[$this->page]['CropBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['CropBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['CropBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['CropBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment
- $this->pagedim[$this->page]['BleedBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['BleedBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['BleedBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['BleedBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['TrimBox'] : the intended dimensions of the finished page after trimming
- $this->pagedim[$this->page]['TrimBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['TrimBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['TrimBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['TrimBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['ArtBox'] : the extent of the page's meaningful content
- $this->pagedim[$this->page]['ArtBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['ArtBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['ArtBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['ArtBox']['ury'] = upper-right y coordinate in points
Returns an array of page dimensions:
- $this->pagedim[$this->page]['w'] = page width in points
- $this->pagedim[$this->page]['h'] = height in points
- $this->pagedim[$this->page]['wk'] = page width in user units
- $this->pagedim[$this->page]['hk'] = page height in user units
- $this->pagedim[$this->page]['tm'] = top margin
- $this->pagedim[$this->page]['bm'] = bottom margin
- $this->pagedim[$this->page]['lm'] = left margin
- $this->pagedim[$this->page]['rm'] = right margin
- $this->pagedim[$this->page]['pb'] = auto page break
- $this->pagedim[$this->page]['or'] = page orientation
- $this->pagedim[$this->page]['olm'] = original left margin
- $this->pagedim[$this->page]['orm'] = original right margin
- $this->pagedim[$this->page]['Rotate'] = The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
- $this->pagedim[$this->page]['PZ'] = The page's preferred zoom (magnification) factor.
- $this->pagedim[$this->page]['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
- $this->pagedim[$this->page]['trans']['Dur'] = The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
- $this->pagedim[$this->page]['trans']['S'] = transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
- $this->pagedim[$this->page]['trans']['D'] = The duration of the transition effect, in seconds.
- $this->pagedim[$this->page]['trans']['Dm'] = (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
- $this->pagedim[$this->page]['trans']['M'] = (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
- $this->pagedim[$this->page]['trans']['Di'] = (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
- $this->pagedim[$this->page]['trans']['SS'] = (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
- $this->pagedim[$this->page]['trans']['B'] = (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
- $this->pagedim[$this->page]['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed
- $this->pagedim[$this->page]['MediaBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['MediaBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['MediaBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['MediaBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['CropBox'] : the visible region of default user space
- $this->pagedim[$this->page]['CropBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['CropBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['CropBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['CropBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment
- $this->pagedim[$this->page]['BleedBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['BleedBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['BleedBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['BleedBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['TrimBox'] : the intended dimensions of the finished page after trimming
- $this->pagedim[$this->page]['TrimBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['TrimBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['TrimBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['TrimBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['ArtBox'] : the extent of the page's meaningful content
- $this->pagedim[$this->page]['ArtBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['ArtBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['ArtBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['ArtBox']['ury'] = upper-right y coordinate in points
Parameters
- $pagenum
- page number (empty = current page)
Returns
array of page dimensions.
Author
Nicola Asuni
Since
4.5.027 (2009-03-16)
Public
|
public
integer
|
#
getPageWidth( $pagenum = '' )
Returns the page width in units.
Returns the page width in units.
Parameters
- $pagenum
- page number (empty = current page)
Returns
integer page width.
Author
Nicola Asuni
Since
1.5.2
See
Public
|
public
integer
|
#
getPageHeight( $pagenum = '' )
Returns the page height in units.
Returns the page height in units.
Parameters
- $pagenum
- page number (empty = current page)
Returns
integer page height.
Author
Nicola Asuni
Since
1.5.2
See
Public
|
public
integer
|
#
getBreakMargin( $pagenum = '' )
Returns the page break margin.
Returns the page break margin.
Parameters
- $pagenum
- page number (empty = current page)
Returns
integer page break margin.
Author
Nicola Asuni
Since
1.5.2
See
Public
|
public
integer
|
#
getScaleFactor( )
Returns the scale factor (number of points in user unit).
Returns the scale factor (number of points in user unit).
Returns
integer scale factor.
Author
Nicola Asuni
Since
1.5.2
Public
|
public
|
#
SetMargins( $left, $top, $right = -1, $keepmargins = false )
Defines the left, top and right margins.
Defines the left, top and right margins.
Parameters
- $left
- Left margin.
- $top
- Top margin.
- $right
- Right margin. Default value is the left one.
- $keepmargins
- if true overwrites the default page margins
Since
1.0
See
Public
|
public
|
#
SetLeftMargin( $margin )
Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.
Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.
Parameters
Since
1.4
See
Public
|
public
|
#
SetTopMargin( $margin )
Defines the top margin. The method can be called before creating the first page.
Defines the top margin. The method can be called before creating the first page.
Parameters
Since
1.5
See
Public
|
public
|
#
SetRightMargin( $margin )
Defines the right margin. The method can be called before creating the first page.
Defines the right margin. The method can be called before creating the first page.
Parameters
Since
1.5
See
Public
|
public
|
#
SetCellPadding( $pad )
Set the same internal Cell padding for top, right, bottom, left-
Set the same internal Cell padding for top, right, bottom, left-
Parameters
Since
2.1.000 (2008-01-09)
See
Public
|
public
|
#
setCellPaddings( $left = '', $top = '', $right = '', $bottom = '' )
Set the internal Cell paddings.
Set the internal Cell paddings.
Parameters
- $left
- left padding
- $top
- top padding
- $right
- right padding
- $bottom
- bottom padding
Since
5.9.000 (2010-10-03)
See
Public
|
public
array
|
#
getCellPaddings( )
Get the internal Cell padding array.
Get the internal Cell padding array.
Returns
array of padding values
Since
5.9.000 (2010-10-03)
See
Public
|
public
|
#
setCellMargins( $left = '', $top = '', $right = '', $bottom = '' )
Set the internal Cell margins.
Set the internal Cell margins.
Parameters
- $left
- left margin
- $top
- top margin
- $right
- right margin
- $bottom
- bottom margin
Since
5.9.000 (2010-10-03)
See
Public
|
public
array
|
#
getCellMargins( )
Get the internal Cell margin array.
Get the internal Cell margin array.
Returns
array of margin values
Since
5.9.000 (2010-10-03)
See
Public
|
protected
array
|
#
adjustCellPadding( $brd = 0 )
Adjust the internal Cell padding array to take account of the line width.
Adjust the internal Cell padding array to take account of the line width.
Parameters
- $brd
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
Returns
array of adjustments
Since
5.9.000 (2010-10-03)
Public
|
public
|
#
SetAutoPageBreak( $auto, $margin = 0 )
Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.
Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.
Parameters
- $auto
- Boolean indicating if mode should be on or off.
- $margin
- Distance from the bottom of the page.
Since
1.0
See
Public
|
public
boolean
|
#
getAutoPageBreak( )
Return the auto-page-break mode (true or false).
Return the auto-page-break mode (true or false).
Returns
boolean auto-page-break mode
Since
5.9.088
Public
|
public
|
#
SetDisplayMode( $zoom, $layout = 'SinglePage', $mode = 'UseNone' )
Defines the way the document is to be displayed by the viewer.
Defines the way the document is to be displayed by the viewer.
Parameters
- $zoom
The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.
- fullpage: displays the entire page on screen
- fullwidth: uses maximum width of window
- real: uses real size (equivalent to 100% zoom)
- default: uses viewer default mode
- $layout
The page layout. Possible values are:
- SinglePage Display one page at a time
- OneColumn Display the pages in one column
- TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
- TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
- TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left
- TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right
- $mode
A name object specifying how the document should be displayed when opened:
- UseNone Neither document outline nor thumbnail images visible
- UseOutlines Document outline visible
- UseThumbs Thumbnail images visible
- FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible
- UseOC (PDF 1.5) Optional content group panel visible
- UseAttachments (PDF 1.6) Attachments panel visible
Since
1.2
Public
|
public
|
#
SetCompression( $compress = true )
Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default.
Note: the Zlib extension is required for this feature. If not present, compression will be turned off.
Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default.
Note: the Zlib extension is required for this feature. If not present, compression will be turned off.
Parameters
- $compress
- Boolean indicating if compression must be enabled.
Since
1.4
Public
|
public
|
#
setSRGBmode( $mode = false )
Set flag to force sRGB_IEC61966-2.1 black scaled ICC color profile for the whole document.
Set flag to force sRGB_IEC61966-2.1 black scaled ICC color profile for the whole document.
Parameters
- $mode
- If true force sRGB output intent.
Since
5.9.121 (2011-09-28)
Public
|
public
|
#
SetDocInfoUnicode( $unicode = true )
Turn on/off Unicode mode for document information dictionary (meta tags).
This has effect only when unicode mode is set to false.
Turn on/off Unicode mode for document information dictionary (meta tags).
This has effect only when unicode mode is set to false.
Parameters
- $unicode
- if true set the meta information in Unicode
Since
5.9.027 (2010-12-01)
Public
|
public
|
#
SetTitle( $title )
Defines the title of the document.
Defines the title of the document.
Parameters
Since
1.2
See
Public
|
public
|
#
SetSubject( $subject )
Defines the subject of the document.
Defines the subject of the document.
Parameters
Since
1.2
See
Public
|
public
|
#
SetAuthor( $author )
Defines the author of the document.
Defines the author of the document.
Parameters
- $author
- The name of the author.
Since
1.2
See
Public
|
public
|
#
SetKeywords( $keywords )
Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
Parameters
- $keywords
- The list of keywords.
Since
1.2
See
Public
|
public
|
#
SetCreator( $creator )
Defines the creator of the document. This is typically the name of the application that generates the PDF.
Defines the creator of the document. This is typically the name of the application that generates the PDF.
Parameters
- $creator
- The name of the creator.
Since
1.2
See
Public
|
public
|
#
Error( $msg )
Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.
Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.
Parameters
Since
1.0
Public
|
public
|
#
Open( )
This method begins the generation of the PDF document.
It is not necessary to call it explicitly because AddPage() does it automatically.
Note: no page is created by this method
This method begins the generation of the PDF document.
It is not necessary to call it explicitly because AddPage() does it automatically.
Note: no page is created by this method
Since
1.0
See
Public
|
public
|
#
Close( )
Terminates the PDF document.
It is not necessary to call this method explicitly because Output() does it automatically.
If the document contains no page, AddPage() is called to prevent from getting an invalid document.
Terminates the PDF document.
It is not necessary to call this method explicitly because Output() does it automatically.
If the document contains no page, AddPage() is called to prevent from getting an invalid document.
Since
1.0
See
Public
|
public
|
#
setPage( $pnum, $resetmargins = false )
Move pointer at the specified document page and update page dimensions.
Move pointer at the specified document page and update page dimensions.
Parameters
- $pnum
- page number (1 ... numpages)
- $resetmargins
- if true reset left, right, top margins and Y position.
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
lastPage( $resetmargins = false )
Reset pointer to the last document page.
Reset pointer to the last document page.
Parameters
- $resetmargins
- if true reset left, right, top margins and Y position.
Since
2.0.000 (2008-01-04)
See
Public
|
public
integer
|
#
getPage( )
Get current document page number.
Get current document page number.
Returns
integer page number
Since
2.1.000 (2008-01-07)
See
Public
|
public
integer
|
#
getNumPages( )
Get the total number of insered pages.
Get the total number of insered pages.
Returns
integer number of pages
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
addTOCPage( $orientation = '', $format = '', $keepmargins = false )
Adds a new TOC (Table Of Content) page to the document.
Adds a new TOC (Table Of Content) page to the document.
Parameters
- $orientation
- page orientation.
- $format
- The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().
- $keepmargins
- if true overwrites the default page margins with the current margins
Since
5.0.001 (2010-05-06)
See
Public
|
public
|
#
endTOCPage( )
Terminate the current TOC (Table Of Content) page
Terminate the current TOC (Table Of Content) page
Since
5.0.001 (2010-05-06)
See
Public
|
public
|
#
AddPage( $orientation = '', $format = '', $keepmargins = false, $tocpage = false )
Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer (if enabled). Then the page is added, the current position set to the top-left corner according to the left and top margins (or top-right if in RTL mode), and Header() is called to display the header (if enabled).
The origin of the coordinate system is at the top-left corner (or top-right for RTL) and increasing ordinates go downwards.
Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer (if enabled). Then the page is added, the current position set to the top-left corner according to the left and top margins (or top-right if in RTL mode), and Header() is called to display the header (if enabled).
The origin of the coordinate system is at the top-left corner (or top-right for RTL) and increasing ordinates go downwards.
Parameters
- $orientation
page orientation. Possible values are (case insensitive):
- P or PORTRAIT (default)
- L or LANDSCAPE
- $format
- The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().
- $keepmargins
- if true overwrites the default page margins with the current margins
- $tocpage
- if true set the tocpage state to true (the added page will be used to display Table Of Content).
Since
1.0
See
Public
|
public
|
#
endPage( $tocpage = false )
Terminate the current page
Terminate the current page
Parameters
- $tocpage
- if true set the tocpage state to false (end the page used to display Table Of Content).
Since
4.2.010 (2008-11-14)
See
Public
|
public
|
#
startPage( $orientation = '', $format = '', $tocpage = false )
Starts a new page to the document. The page must be closed using the endPage() function.
The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards.
Starts a new page to the document. The page must be closed using the endPage() function.
The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards.
Parameters
- $orientation
page orientation. Possible values are (case insensitive):
- P or PORTRAIT (default)
- L or LANDSCAPE
- $format
- The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().
- $tocpage
- if true the page is designated to contain the Table-Of-Content.
Since
4.2.010 (2008-11-14)
See
Public
|
public
|
#
setPageMark( )
Set start-writing mark on current page stream used to put borders and fills.
Borders and fills are always created after content and inserted on the position marked by this method.
This function must be called after calling Image() function for a background image.
Background images must be always inserted before calling Multicell() or WriteHTMLCell() or WriteHTML() functions.
Set start-writing mark on current page stream used to put borders and fills.
Borders and fills are always created after content and inserted on the position marked by this method.
This function must be called after calling Image() function for a background image.
Background images must be always inserted before calling Multicell() or WriteHTMLCell() or WriteHTML() functions.
Since
4.0.016 (2008-07-30)
Public
|
protected
|
#
setContentMark( $page = 0 )
Set start-writing mark on selected page.
Borders and fills are always created after content and inserted on the position marked by this method.
Set start-writing mark on selected page.
Borders and fills are always created after content and inserted on the position marked by this method.
Parameters
- $page
- page number (default is the current page)
Since
4.6.021 (2009-07-20)
Protected
|
public
float
|
#
getImageRBX( )
Return the right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image
Return the right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image
Returns
float
Public
|
public
float
|
#
getImageRBY( )
Return the right-bottom (or left-bottom for RTL) corner Y coordinate of last inserted image
Return the right-bottom (or left-bottom for RTL) corner Y coordinate of last inserted image
Returns
float
Public
|
protected
true
|
#
inPageBody( )
Check if we are on the page body (excluding page header and footer).
Check if we are on the page body (excluding page header and footer).
Returns
true if we are not in page header nor in page footer, false otherwise.
Since
5.9.091 (2011-06-15)
Protected
|
public
integer
|
#
PageNo( )
Returns the current page number.
Returns the current page number.
Returns
integer page number
Since
1.0
See
Public
|
public
(array)
|
#
getAllSpotColors( )
Returns the array of spot colors.
Returns the array of spot colors.
Returns
(array) Spot colors array.
Since
6.0.038 (2013-09-30)
Public
|
public
|
#
AddSpotColor( $name, $c, $m, $y, $k )
Defines a new spot color.
It can be expressed in RGB components or gray scale.
The method can be called before the first page is created and the value is retained from page to page.
Defines a new spot color.
It can be expressed in RGB components or gray scale.
The method can be called before the first page is created and the value is retained from page to page.
Parameters
- $name
- Full name of the spot color.
- $c
- Cyan color for CMYK. Value between 0 and 100.
- $m
- Magenta color for CMYK. Value between 0 and 100.
- $y
- Yellow color for CMYK. Value between 0 and 100.
- $k
- Key (Black) color for CMYK. Value between 0 and 100.
Since
4.0.024 (2008-09-12)
See
Public
|
public
(string)
|
#
setSpotColor( $type, $name, $tint = 100 )
Set the spot color for the specified type ('draw', 'fill', 'text').
Set the spot color for the specified type ('draw', 'fill', 'text').
Parameters
- $type
- Type of object affected by this color: ('draw', 'fill', 'text').
- $name
- Name of the spot color.
- $tint
- Intensity of the color (from 0 to 100 ; 100 = full intensity by default).
Returns
(string) PDF color command.
Since
5.9.125 (2011-10-03)
Public
|
public
|
#
SetDrawSpotColor( $name, $tint = 100 )
Defines the spot color used for all drawing operations (lines, rectangles and cell borders).
Defines the spot color used for all drawing operations (lines, rectangles and cell borders).
Parameters
- $name
- Name of the spot color.
- $tint
- Intensity of the color (from 0 to 100 ; 100 = full intensity by default).
Since
4.0.024 (2008-09-12)
See
Public
|
public
|
#
SetFillSpotColor( $name, $tint = 100 )
Defines the spot color used for all filling operations (filled rectangles and cell backgrounds).
Defines the spot color used for all filling operations (filled rectangles and cell backgrounds).
Parameters
- $name
- Name of the spot color.
- $tint
- Intensity of the color (from 0 to 100 ; 100 = full intensity by default).
Since
4.0.024 (2008-09-12)
See
Public
|
public
|
#
SetTextSpotColor( $name, $tint = 100 )
Defines the spot color used for text.
Defines the spot color used for text.
Parameters
- $name
- Name of the spot color.
- $tint
- Intensity of the color (from 0 to 100 ; 100 = full intensity by default).
Since
4.0.024 (2008-09-12)
See
Public
|
public
(string)
|
#
setColorArray( $type, $color, $ret = false )
Set the color array for the specified type ('draw', 'fill', 'text').
It can be expressed in RGB, CMYK or GRAY SCALE components.
The method can be called before the first page is created and the value is retained from page to page.
Set the color array for the specified type ('draw', 'fill', 'text').
It can be expressed in RGB, CMYK or GRAY SCALE components.
The method can be called before the first page is created and the value is retained from page to page.
Parameters
- $type
- Type of object affected by this color: ('draw', 'fill', 'text').
- $color
- Array of colors (1=gray, 3=RGB, 4=CMYK or 5=spotcolor=CMYK+name values).
- $ret
- If true do not send the PDF command.
Returns
(string) The PDF command or empty string.
Since
3.1.000 (2008-06-11)
Public
|
public
string
|
#
SetDrawColorArray( $color, $ret = false )
Defines the color used for all drawing operations (lines, rectangles and cell borders).
It can be expressed in RGB, CMYK or GRAY SCALE components.
The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for all drawing operations (lines, rectangles and cell borders).
It can be expressed in RGB, CMYK or GRAY SCALE components.
The method can be called before the first page is created and the value is retained from page to page.
Parameters
- $color
- Array of colors (1, 3 or 4 values).
- $ret
- If true do not send the PDF command.
Returns
string the PDF command
Since
3.1.000 (2008-06-11)
See
Public
|
public
|
#
SetFillColorArray( $color, $ret = false )
Defines the color used for all filling operations (filled rectangles and cell backgrounds).
It can be expressed in RGB, CMYK or GRAY SCALE components.
The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for all filling operations (filled rectangles and cell backgrounds).
It can be expressed in RGB, CMYK or GRAY SCALE components.
The method can be called before the first page is created and the value is retained from page to page.
Parameters
- $color
- Array of colors (1, 3 or 4 values).
- $ret
- If true do not send the PDF command.
Since
3.1.000 (2008-6-11)
See
Public
|
public
|
#
SetTextColorArray( $color, $ret = false )
Defines the color used for text. It can be expressed in RGB components or gray scale.
The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for text. It can be expressed in RGB components or gray scale.
The method can be called before the first page is created and the value is retained from page to page.
Parameters
- $color
- Array of colors (1, 3 or 4 values).
- $ret
- If true do not send the PDF command.
Since
3.1.000 (2008-6-11)
See
Public
|
public
(string)
|
#
setColor( $type, $col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '' )
Defines the color used by the specified type ('draw', 'fill', 'text').
Defines the color used by the specified type ('draw', 'fill', 'text').
Parameters
- $type
- Type of object affected by this color: ('draw', 'fill', 'text').
- $col1
- GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100).
- $col2
- GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100).
- $col3
- BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100).
- $col4
- KEY (BLACK) color for CMYK (0-100).
- $ret
- If true do not send the command.
- $name
- spot color name (if any)
Returns
(string) The PDF command or empty string.
Since
5.9.125 (2011-10-03)
Public
|
public
string
|
#
SetDrawColor( $col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '' )
Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Parameters
- $col1
- GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100).
- $col2
- GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100).
- $col3
- BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100).
- $col4
- KEY (BLACK) color for CMYK (0-100).
- $ret
- If true do not send the command.
- $name
- spot color name (if any)
Returns
string the PDF command
Since
1.3
See
Public
|
public
(string)
|
#
SetFillColor( $col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '' )
Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Parameters
- $col1
- GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100).
- $col2
- GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100).
- $col3
- BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100).
- $col4
- KEY (BLACK) color for CMYK (0-100).
- $ret
- If true do not send the command.
- $name
- Spot color name (if any).
Returns
(string) The PDF command.
Since
1.3
See
Public
|
public
(string)
|
#
SetTextColor( $col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '' )
Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Parameters
- $col1
- GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100).
- $col2
- GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100).
- $col3
- BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100).
- $col4
- KEY (BLACK) color for CMYK (0-100).
- $ret
- If true do not send the command.
- $name
- Spot color name (if any).
Returns
(string) Empty string.
Since
1.3
See
Public
|
public
mixed
|
#
GetStringWidth( $s, $fontname = '', $fontstyle = '', $fontsize = 0, $getarray = false )
Returns the length of a string in user unit. A font must be selected.
Returns the length of a string in user unit. A font must be selected.
Parameters
- $s
- The string whose length is to be computed
- $fontname
- Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained.
- $fontstyle
Font style. Possible values are (case insensitive):
- empty string: regular
- B: bold
- I: italic
- U: underline
- D: line-through
- O: overline
or any combination. The default value is regular.
- $fontsize
- Font size in points. The default value is the current size.
- $getarray
- if true returns an array of characters widths, if false returns the total length.
Returns
mixed int total string length or array of characted widths
Author
Nicola Asuni
Since
1.2
Public
|
public
mixed
|
#
GetArrStringWidth( $sa, $fontname = '', $fontstyle = '', $fontsize = 0, $getarray = false )
Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.
Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.
Parameters
- $sa
- The array of chars whose total length is to be computed
- $fontname
- Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained.
- $fontstyle
Font style. Possible values are (case insensitive):
- empty string: regular
- B: bold
- I: italic
- U: underline
- D: line through
- O: overline
or any combination. The default value is regular.
- $fontsize
- Font size in points. The default value is the current size.
- $getarray
- if true returns an array of characters widths, if false returns the total length.
Returns
mixed int total string length or array of characted widths
Author
Nicola Asuni
Since
2.4.000 (2008-03-06)
Public
|
public
float
|
#
GetCharWidth( $char, $notlast = true )
Returns the length of the char in user unit for the current font considering current stretching and spacing (tracking).
Returns the length of the char in user unit for the current font considering current stretching and spacing (tracking).
Parameters
- $char
- The char code whose length is to be returned
- $notlast
- If false ignore the font-spacing.
Returns
float char width
Author
Nicola Asuni
Since
2.4.000 (2008-03-06)
Public
|
public
float
|
#
getRawCharWidth( $char )
Returns the length of the char in user unit for the current font.
Returns the length of the char in user unit for the current font.
Parameters
- $char
- The char code whose length is to be returned
Returns
float char width
Author
Nicola Asuni
Since
5.9.000 (2010-09-28)
Public
|
public
integer
|
#
GetNumChars( $s )
Returns the numbero of characters in a string.
Returns the numbero of characters in a string.
Parameters
Returns
integer number of characters
Since
2.0.0001 (2008-01-07)
Public
|
protected
|
#
getFontsList( )
Fill the list of available fonts ($this->fontlist).
Fill the list of available fonts ($this->fontlist).
Since
4.0.013 (2008-07-28)
Protected
|
public
array
|
#
AddFont( $family, $style = '', $fontfile = '', $subset = 'default' )
Imports a TrueType, Type1, core, or CID0 font and makes it available.
It is necessary to generate a font definition file first (read /fonts/utils/README.TXT).
The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by K_PATH_FONTS if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.
Imports a TrueType, Type1, core, or CID0 font and makes it available.
It is necessary to generate a font definition file first (read /fonts/utils/README.TXT).
The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by K_PATH_FONTS if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.
Parameters
- $family
- Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font.
- $style
Font style. Possible values are (case insensitive):
- empty string: regular (default)
- B: bold
- I: italic
- BI or IB: bold italic
- $fontfile
- The font definition file. By default, the name is built from the family and style, in lower case with no spaces.
- $subset
- if true embedd only a subset of the font (stores only the information related to the used characters); if false embedd full font; if 'default' uses the default value set using setFontSubsetting(). This option is valid only for TrueTypeUnicode fonts. If you want to enable users to change the document, set this parameter to false. If you subset the font, the person who receives your PDF would need to have your same font in order to make changes to your PDF. The file size of the PDF would also be smaller because you are embedding only part of a font.
Returns
array containing the font data, or false in case of error.
Since
1.5
See
Public
|
public
|
#
SetFont( $family, $style = '', $size = null, $fontfile = '', $subset = 'default', $out = true )
Sets the font used to print character strings.
The font can be either a standard one or a font added via the AddFont() method. Standard fonts use Windows encoding cp1252 (Western Europe).
The method can be called before the first page is created and the font is retained from page to page.
If you just wish to change the current font size, it is simpler to call SetFontSize().
Note: for the standard fonts, the font metric files must be accessible. There are three possibilities for this:
- They are in the current directory (the one where the running script lies)
- They are in one of the directories defined by the include_path parameter
- They are in the directory defined by the K_PATH_FONTS constant
Sets the font used to print character strings.
The font can be either a standard one or a font added via the AddFont() method. Standard fonts use Windows encoding cp1252 (Western Europe).
The method can be called before the first page is created and the font is retained from page to page.
If you just wish to change the current font size, it is simpler to call SetFontSize().
Note: for the standard fonts, the font metric files must be accessible. There are three possibilities for this:
- They are in the current directory (the one where the running script lies)
- They are in one of the directories defined by the include_path parameter
- They are in the directory defined by the K_PATH_FONTS constant
Parameters
- $family
Family font. It can be either a name defined by AddFont() or one of the standard Type1 families (case insensitive):
- times (Times-Roman)
- timesb (Times-Bold)
- timesi (Times-Italic)
- timesbi (Times-BoldItalic)
- helvetica (Helvetica)
- helveticab (Helvetica-Bold)
- helveticai (Helvetica-Oblique)
- helveticabi (Helvetica-BoldOblique)
- courier (Courier)
- courierb (Courier-Bold)
- courieri (Courier-Oblique)
- courierbi (Courier-BoldOblique)
- symbol (Symbol)
- zapfdingbats (ZapfDingbats)
It is also possible to pass an empty string. In that case, the current family is retained.
- $style
Font style. Possible values are (case insensitive):
- empty string: regular
- B: bold
- I: italic
- U: underline
- D: line through
- O: overline
or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats basic fonts or other fonts when not defined.
- $size
- Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12
- $fontfile
- The font definition file. By default, the name is built from the family and style, in lower case with no spaces.
- $subset
- if true embedd only a subset of the font (stores only the information related to the used characters); if false embedd full font; if 'default' uses the default value set using setFontSubsetting(). This option is valid only for TrueTypeUnicode fonts. If you want to enable users to change the document, set this parameter to false. If you subset the font, the person who receives your PDF would need to have your same font in order to make changes to your PDF. The file size of the PDF would also be smaller because you are embedding only part of a font.
- $out
- if true output the font size command, otherwise only set the font properties.
Author
Nicola Asuni
Since
1.0
See
Public
|
public
|
#
SetFontSize( $size, $out = true )
Defines the size of the current font.
Defines the size of the current font.
Parameters
- $size
- The font size in points.
- $out
- if true output the font size command, otherwise only set the font properties.
Since
1.0
See
Public
|
public
array
|
#
getFontBBox( )
Returns the bounding box of the current font in user units.
Returns the bounding box of the current font in user units.
Returns
array
Since
5.9.152 (2012-03-23)
Public
|
public
float
|
#
getAbsFontMeasure( $s )
Convert a relative font measure into absolute value.
Convert a relative font measure into absolute value.
Parameters
Returns
float Absolute measure.
Since
5.9.186 (2012-09-13)
|
public
mixed
|
#
getCharBBox( $char )
Returns the glyph bounding box of the specified character in the current font in user units.
Returns the glyph bounding box of the specified character in the current font in user units.
Parameters
- $char
- Input character code.
Returns
mixed array(xMin, yMin, xMax, yMax) or FALSE if not defined.
Since
5.9.186 (2012-09-13)
|
public
integer
|
#
getFontDescent( $font, $style = '', $size = 0 )
Return the font descent value
Return the font descent value
Parameters
- $font
- font name
- $style
- font style
- $size
- The size (in points)
Returns
integer font descent
Author
Nicola Asuni
Since
4.9.003 (2010-03-30)
Public
|
public
integer
|
#
getFontAscent( $font, $style = '', $size = 0 )
Return the font ascent value.
Return the font ascent value.
Parameters
- $font
- font name
- $style
- font style
- $size
- The size (in points)
Returns
integer font ascent
Author
Nicola Asuni
Since
4.9.003 (2010-03-30)
Public
|
public
(boolean)
|
#
isCharDefined( $char, $font = '', $style = '' )
Return true in the character is present in the specified font.
Return true in the character is present in the specified font.
Parameters
- $char
- Character to check (integer value or string)
- $font
- Font name (family name).
- $style
- Font style.
Returns
(boolean) true if the char is defined, false otherwise.
Since
5.9.153 (2012-03-28)
Public
|
public
(string)
|
#
replaceMissingChars( $text, $font = '', $style = '', $subs = array() )
Replace missing font characters on selected font with specified substitutions.
Replace missing font characters on selected font with specified substitutions.
Parameters
- $text
- Text to process.
- $font
- Font name (family name).
- $style
- Font style.
- $subs
- Array of possible character substitutions. The key is the character to check (integer value) and the value is a single intege value or an array of possible substitutes.
Returns
(string) Processed text.
Since
5.9.153 (2012-03-28)
Public
|
public
|
#
SetDefaultMonospacedFont( $font )
Defines the default monospaced font.
Defines the default monospaced font.
Parameters
Since
4.5.025
Public
|
public
|
#
AddLink( )
Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document.
The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().
Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document.
The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().
Since
1.5
See
Public
|
public
|
#
SetLink( $link, $y = 0, $page = -1 )
Defines the page and position a link points to.
Defines the page and position a link points to.
Parameters
- $link
- The link identifier returned by AddLink()
- $y
- Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page)
- $page
- Number of target page; -1 indicates the current page (default value). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.
Since
1.5
See
Public
|
public
|
#
Link( $x, $y, $w, $h, $link, $spaces = 0 )
Puts a link on a rectangular area of the page.
Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image.
Puts a link on a rectangular area of the page.
Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image.
Parameters
- $x
- Abscissa of the upper-left corner of the rectangle
- $y
- Ordinate of the upper-left corner of the rectangle
- $w
- Width of the rectangle
- $h
- Height of the rectangle
- $link
- URL or identifier returned by AddLink()
- $spaces
- number of spaces on the text to link
Since
1.5
See
Public
|
public
|
#
Annotation( $x, $y, $w, $h, $text, $opt = array('Subtype'=>'Text'), $spaces = 0 )
Puts a markup annotation on a rectangular area of the page.
!!!!THE ANNOTATION SUPPORT IS NOT YET FULLY IMPLEMENTED !!!!
Puts a markup annotation on a rectangular area of the page.
!!!!THE ANNOTATION SUPPORT IS NOT YET FULLY IMPLEMENTED !!!!
Parameters
- $x
- Abscissa of the upper-left corner of the rectangle
- $y
- Ordinate of the upper-left corner of the rectangle
- $w
- Width of the rectangle
- $h
- Height of the rectangle
- $text
- annotation text or alternate content
- $opt
- array of options (see section 8.4 of PDF reference 1.7).
- $spaces
- number of spaces on the text to link
Since
4.0.018 (2008-08-06)
Public
|
protected
|
#
_putEmbeddedFiles( )
Embedd the attached files.
Embedd the attached files.
Since
4.4.000 (2008-12-07)
See
Protected
|
public
|
#
Text( $x, $y, $txt, $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false )
Prints a text cell at the specified position.
This method allows to place a string precisely on the page.
Prints a text cell at the specified position.
This method allows to place a string precisely on the page.
Parameters
- $x
- Abscissa of the cell origin
- $y
- Ordinate of the cell origin
- $txt
- String to print
- $fstroke
- outline size in user units (false = disable)
- $fclip
- if true activate clipping mode (you must call StartTransform() before this function and StopTransform() to stop the clipping tranformation).
- $ffill
- if true fills the text
- $border
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
- $ln
Indicates where the current position should go after the call. Possible values are:
- 0: to the right (or left for RTL languages)
- 1: to the beginning of the next line
- 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
- $align
Allows to center or align the text. Possible values are:
- L or empty string: left align (default value)
- C: center
- R: right align
- J: justify
- $fill
- Indicates if the cell background must be painted (true) or transparent (false).
- $link
- URL or identifier returned by AddLink().
- $stretch
font stretch mode:
- 0 = disabled
- 1 = horizontal scaling only if text is larger than cell width
- 2 = forced horizontal scaling to fit cell width
- 3 = character spacing only if text is larger than cell width
- 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.
- $ignore_min_height
- if true ignore automatic minimum height value.
- $calign
cell vertical alignment relative to the specified Y value. Possible values are:
- T : cell top
- A : font top
- L : font baseline
- D : font bottom
- B : cell bottom
- $valign
text vertical alignment inside the cell. Possible values are:
- T : top
- C : center
- B : bottom
- $rtloff
- if true uses the page top-left corner as origin of axis for $x and $y initial position.
Since
1.0
See
Public
|
public
boolean
|
#
AcceptPageBreak( )
Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value.
The default implementation returns a value according to the mode selected by SetAutoPageBreak().
This method is called automatically and should not be called directly by the application.
Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value.
The default implementation returns a value according to the mode selected by SetAutoPageBreak().
This method is called automatically and should not be called directly by the application.
Returns
boolean
Since
1.4
See
Public
|
protected
boolean
|
#
checkPageBreak( $h = 0, $y = '', $addpage = true )
Add page if needed.
Parameters
- $h
- Cell height. Default value: 0.
- $y
- starting y position, leave empty for current position.
- $addpage
- if true add a page, otherwise only return the true/false state
Returns
boolean true in case of page break, false otherwise.
Since
3.2.000 (2008-07-01)
Protected
|
public
|
#
Cell( $w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M' )
Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
Parameters
- $w
- Cell width. If 0, the cell extends up to the right margin.
- $h
- Cell height. Default value: 0.
- $txt
- String to print. Default value: empty string.
- $border
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
- $ln
Indicates where the current position should go after the call. Possible values are:
- 0: to the right (or left for RTL languages)
- 1: to the beginning of the next line
- 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
- $align
Allows to center or align the text. Possible values are:
- L or empty string: left align (default value)
- C: center
- R: right align
- J: justify
- $fill
- Indicates if the cell background must be painted (true) or transparent (false).
- $link
- URL or identifier returned by AddLink().
- $stretch
font stretch mode:
- 0 = disabled
- 1 = horizontal scaling only if text is larger than cell width
- 2 = forced horizontal scaling to fit cell width
- 3 = character spacing only if text is larger than cell width
- 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.
- $ignore_min_height
- if true ignore automatic minimum height value.
- $calign
cell vertical alignment relative to the specified Y value. Possible values are:
- T : cell top
- C : center
- B : cell bottom
- A : font top
- L : font baseline
- D : font bottom
- $valign
text vertical alignment inside the cell. Possible values are:
- T : top
- C : center
- B : bottom
Since
1.0
See
Public
|
protected
string
|
#
getCellCode( $w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M' )
Returns the PDF string code to print a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
Returns the PDF string code to print a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
Parameters
- $w
- Cell width. If 0, the cell extends up to the right margin.
- $h
- Cell height. Default value: 0.
- $txt
- String to print. Default value: empty string.
- $border
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
- $ln
Indicates where the current position should go after the call. Possible values are:
- 0: to the right (or left for RTL languages)
- 1: to the beginning of the next line
- 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
- $align
Allows to center or align the text. Possible values are:
- L or empty string: left align (default value)
- C: center
- R: right align
- J: justify
- $fill
- Indicates if the cell background must be painted (true) or transparent (false).
- $link
- URL or identifier returned by AddLink().
- $stretch
font stretch mode:
- 0 = disabled
- 1 = horizontal scaling only if text is larger than cell width
- 2 = forced horizontal scaling to fit cell width
- 3 = character spacing only if text is larger than cell width
- 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.
- $ignore_min_height
- if true ignore automatic minimum height value.
- $calign
cell vertical alignment relative to the specified Y value. Possible values are:
- T : cell top
- C : center
- B : cell bottom
- A : font top
- L : font baseline
- D : font bottom
- $valign
text vertical alignment inside the cell. Possible values are:
- T : top
- M : middle
- B : bottom
Returns
string containing cell code
Since
1.0
See
Protected
|
protected
integer
|
#
replaceChar( $oldchar, $newchar )
Replace a char if is defined on the current font.
Replace a char if is defined on the current font.
Parameters
- $oldchar
- Integer code (unicode) of the character to replace.
- $newchar
- Integer code (unicode) of the new character.
Returns
integer the replaced char or the old char in case the new char i not defined
Since
5.9.167 (2012-06-22)
Protected
|
protected
string
|
#
getCellBorder( $x, $y, $w, $h, $brd )
Returns the code to draw the cell border
Returns the code to draw the cell border
Parameters
- $x
- X coordinate.
- $y
- Y coordinate.
- $w
- Cell width.
- $h
- Cell height.
- $brd
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
Returns
string containing cell border code
Since
5.7.000 (2010-08-02)
See
Protected
|
public
integer
|
#
MultiCell( $w, $h, $txt, $border = 0, $align = 'J', $fill = false, $ln = 1, $x = '', $y = '', $reseth = true, $stretch = 0, $ishtml = false, $autopadding = true, $maxh = 0, $valign = 'T', $fitcell = false )
This method allows printing text with line breaks.
They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other.
Text can be aligned, centered or justified. The cell block can be framed and the background painted.
This method allows printing text with line breaks.
They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other.
Text can be aligned, centered or justified. The cell block can be framed and the background painted.
Parameters
- $w
- Width of cells. If 0, they extend up to the right margin of the page.
- $h
- Cell minimum height. The cell extends automatically if needed.
- $txt
- String to print
- $border
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
- $align
Allows to center or align the text. Possible values are:
- L or empty string: left align
- C: center
- R: right align
- J: justification (default value when $ishtml=false)
- $fill
- Indicates if the cell background must be painted (true) or transparent (false).
- $ln
Indicates where the current position should go after the call. Possible values are:
- 0: to the right
- 1: to the beginning of the next line [DEFAULT]
- 2: below
- $x
- x position in user units
- $y
- y position in user units
- $reseth
- if true reset the last cell height (default true).
- $stretch
font stretch mode:
- 0 = disabled
- 1 = horizontal scaling only if text is larger than cell width
- 2 = forced horizontal scaling to fit cell width
- 3 = character spacing only if text is larger than cell width
- 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.
- $ishtml
- INTERNAL USE ONLY -- set to true if $txt is HTML content (default = false). Never set this parameter to true, use instead writeHTMLCell() or writeHTML() methods.
- $autopadding
- if true, uses internal padding and automatically adjust it to account for line width.
- $maxh
- maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature. This feature works only when $ishtml=false.
- $valign
Vertical alignment of text (requires $maxh = $h > 0). Possible values are:
. This feature works only when $ishtml=false and the cell must fit in a single page.
- $fitcell
- if true attempt to fit all the text within the cell by reducing the font size (do not work in HTML mode). $maxh must be greater than 0 and equal to $h.
Returns
integer Return the number of cells or 1 for html mode.
Since
1.3
See
Public
|
public
float
|
#
getNumLines( $txt, $w = 0, $reseth = false, $autopadding = true, $cellpadding = '', $border = 0 )
This method return the estimated number of lines for print a simple text string using Multicell() method.
This method return the estimated number of lines for print a simple text string using Multicell() method.
Parameters
- $txt
- String for calculating his height
- $w
- Width of cells. If 0, they extend up to the right margin of the page.
- $reseth
- if true reset the last cell height (default false).
- $autopadding
- if true, uses internal padding and automatically adjust it to account for line width (default true).
- $cellpadding
- Internal cell padding, if empty uses default cell padding.
- $border
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
Returns
float Return the minimal height needed for multicell method for printing the $txt param.
Author
Alexander Escalona Fern\E1ndez, Nicola Asuni
Since
4.5.011
Public
|
public
float
|
#
getStringHeight( $w, $txt, $reseth = false, $autopadding = true, $cellpadding = '', $border = 0 )
This method return the estimated height needed for printing a simple text string using the Multicell() method.
Generally, if you want to know the exact height for a block of content you can use the following alternative technique:
This method return the estimated height needed for printing a simple text string using the Multicell() method.
Generally, if you want to know the exact height for a block of content you can use the following alternative technique:
Parameters
- $w
- Width of cells. If 0, they extend up to the right margin of the page.
- $txt
- String for calculating his height
- $reseth
- if true reset the last cell height (default false).
- $autopadding
- if true, uses internal padding and automatically adjust it to account for line width (default true).
- $cellpadding
- Internal cell padding, if empty uses default cell padding.
- $border
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
Returns
float Return the minimal height needed for multicell method for printing the $txt param.
Author
Nicola Asuni, Alexander Escalona Fern\E1ndez
Pre
// store current object
$pdf->startTransaction();
// store starting values
$start_y = $pdf->GetY();
$start_page = $pdf->getPage();
// call your printing functions with your parameters
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$pdf->MultiCell($w=0, $h=0, $txt, $border=1, $align='L', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// get the new Y
$end_y = $pdf->GetY();
$end_page = $pdf->getPage();
// calculate height
$height = 0;
if ($end_page == $start_page) {
$height = $end_y - $start_y;
} else {
for ($page=$start_page; $page <= $end_page; ++$page) {
$this->setPage($page);
if ($page == $start_page) {
// first page
$height = $this->h - $start_y - $this->bMargin;
} elseif ($page == $end_page) {
// last page
$height = $end_y - $this->tMargin;
} else {
$height = $this->h - $this->tMargin - $this->bMargin;
}
}
}
// restore previous object
$pdf = $pdf->rollbackTransaction();
Public
|
public
mixed
|
#
Write( $h, $txt, $link = '', $fill = false, $align = '', $ln = false, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0, $wadj = 0, $margin = '' )
This method prints text from the current position.
This method prints text from the current position.
Parameters
- $h
- Line height
- $txt
- String to print
- $link
- URL or identifier returned by AddLink()
- $fill
- Indicates if the cell background must be painted (true) or transparent (false).
- $align
Allows to center or align the text. Possible values are:
- L or empty string: left align (default value)
- C: center
- R: right align
- J: justify
- $ln
- if true set cursor at the bottom of the line, otherwise set cursor at the top of the line.
- $stretch
font stretch mode:
- 0 = disabled
- 1 = horizontal scaling only if text is larger than cell width
- 2 = forced horizontal scaling to fit cell width
- 3 = character spacing only if text is larger than cell width
- 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.
- $firstline
- if true prints only the first line and return the remaining string.
- $firstblock
- if true the string is the starting of a line.
- $maxh
- maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature.
- $wadj
- first line width will be reduced by this amount (used in HTML mode).
- $margin
- margin array of the parent container
Returns
mixed Return the number of cells or the remaining string if $firstline = true.
Since
1.5
Public
|
protected
integer
|
#
getRemainingWidth( )
Returns the remaining width between the current position and margins.
Returns the remaining width between the current position and margins.
Returns
integer Return the remaining width
Protected
|
protected
array($w,
|
#
fitBlock( $w, $h, $x, $y, $fitonpage = false )
Set the block dimensions accounting for page breaks and page/column fitting
Set the block dimensions accounting for page breaks and page/column fitting
Parameters
- $w
- width
- $h
- height
- $x
- X coordinate
- $y
- Y coodiante
- $fitonpage
- if true the block is resized to not exceed page dimensions.
Returns
array($w, $w, $h, $x, $y)
Since
5.5.009 (2010-07-05)
Protected
|
public
image
|
#
Image( $file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false, $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, $hidden = false, $fitonpage = false, $alt = false, $altimgs = array() )
Puts an image in the page.
The upper-left corner must be given.
The dimensions can be specified in different ways:
- explicit width and height (expressed in user unit)
- one explicit dimension, the other being calculated automatically in order to keep the original proportions
- no explicit dimension, in which case the image is put at 72 dpi
Supported formats are JPEG and PNG images whitout GD library and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;
The format can be specified explicitly or inferred from the file extension.
It is possible to put a link on the image.
Remark: if an image is used several times, only one copy will be embedded in the file.
Puts an image in the page.
The upper-left corner must be given.
The dimensions can be specified in different ways:
- explicit width and height (expressed in user unit)
- one explicit dimension, the other being calculated automatically in order to keep the original proportions
- no explicit dimension, in which case the image is put at 72 dpi
Supported formats are JPEG and PNG images whitout GD library and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;
The format can be specified explicitly or inferred from the file extension.
It is possible to put a link on the image.
Remark: if an image is used several times, only one copy will be embedded in the file.
Parameters
- $file
- Name of the file containing the image or a '@' character followed by the image data string. To link an image without embedding it on the document, set an asterisk character before the URL (i.e.: '*http://www.example.com/image.jpg').
- $x
- Abscissa of the upper-left corner (LTR) or upper-right corner (RTL).
- $y
- Ordinate of the upper-left corner (LTR) or upper-right corner (RTL).
- $w
- Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
- $h
- Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
- $type
- Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension.
- $link
- URL or identifier returned by AddLink().
- $align
Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
- T: top-right for LTR or top-left for RTL
- M: middle-right for LTR or middle-left for RTL
- B: bottom-right for LTR or bottom-left for RTL
- N: next line
- $resize
- If true resize (reduce) the image to fit $w and $h (requires GD or ImageMagick library); if false do not resize; if 2 force resize in all cases (upscaling and downscaling).
- $dpi
- dot-per-inch resolution used on resize
- $palign
Allows to center or align the image on the current line. Possible values are:
- L : left align
- C : center
- R : right align
- '' : empty string : left for LTR or right for RTL
- $ismask
- true if this image is a mask, false otherwise
- $imgmask
- image object returned by this function or false
- $border
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
- $fitbox
- If not false scale image dimensions proportionally to fit within the ($w, $h) box. $fitbox can be true or a 2 characters string indicating the image alignment inside the box. The first character indicate the horizontal alignment (L = left, C = center, R = right) the second character indicate the vertical algnment (T = top, M = middle, B = bottom).
- $hidden
- If true do not display the image.
- $fitonpage
- If true the image is resized to not exceed page dimensions.
- $alt
- If true the image will be added as alternative and not directly printed (the ID of the image will be returned).
- $altimgs
- Array of alternate images IDs. Each alternative image must be an array with two values: an integer representing the image ID (the value returned by the Image method) and a boolean value to indicate if the image is the default for printing.
Returns
image information
Since
1.1
Public
|
protected
|
#
ImagePngAlpha( $file, $x, $y, $wpx, $hpx, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $filehash = '' )
Extract info from a PNG image with alpha channel using the Imagick or GD library.
Extract info from a PNG image with alpha channel using the Imagick or GD library.
Parameters
- $file
- Name of the file containing the image.
- $x
- Abscissa of the upper-left corner.
- $y
- Ordinate of the upper-left corner.
- $wpx
- Original width of the image in pixels.
- $hpx
- original height of the image in pixels.
- $w
- Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
- $h
- Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
- $type
- Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension.
- $link
- URL or identifier returned by AddLink().
- $align
Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
- T: top-right for LTR or top-left for RTL
- M: middle-right for LTR or middle-left for RTL
- B: bottom-right for LTR or bottom-left for RTL
- N: next line
- $resize
- If true resize (reduce) the image to fit $w and $h (requires GD library).
- $dpi
- dot-per-inch resolution used on resize
- $palign
Allows to center or align the image on the current line. Possible values are:
- L : left align
- C : center
- R : right align
- '' : empty string : left for LTR or right for RTL
- $filehash
- File hash used to build unique file names.
Author
Nicola Asuni
Since
4.3.007 (2008-12-04)
See
Protected
|
protected
|
#
getGDgamma( $img, $c )
Get the GD-corrected PNG gamma value from alpha color
Get the GD-corrected PNG gamma value from alpha color
Parameters
- $img
- GD image Resource ID.
- $c
- alpha color
Since
4.3.007 (2008-12-04)
Protected
|
public
|
#
Ln( $h = '', $cell = false )
Performs a line break.
The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter.
Performs a line break.
The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter.
Parameters
- $h
- The height of the break. By default, the value equals the height of the last printed cell.
- $cell
- if true add the current left (or right o for RTL) padding to the X coordinate
Since
1.0
See
Public
|
public
float
|
#
GetX( )
Returns the relative X value of current position.
The value is relative to the left border for LTR languages and to the right border for RTL languages.
Returns the relative X value of current position.
The value is relative to the left border for LTR languages and to the right border for RTL languages.
Returns
float
Since
1.2
See
Public
|
public
float
|
#
GetAbsX( )
Returns the absolute X value of current position.
Returns the absolute X value of current position.
Returns
float
Since
1.2
See
Public
|
public
float
|
#
GetY( )
Returns the ordinate of the current position.
Returns the ordinate of the current position.
Returns
float
Since
1.0
See
Public
|
public
|
#
SetX( $x, $rtloff = false )
Defines the abscissa of the current position.
If the passed value is negative, it is relative to the right of the page (or left if language is RTL).
Defines the abscissa of the current position.
If the passed value is negative, it is relative to the right of the page (or left if language is RTL).
Parameters
- $x
- The value of the abscissa in user units.
- $rtloff
- if true always uses the page top-left corner as origin of axis.
Since
1.2
See
Public
|
public
|
#
SetY( $y, $resetx = true, $rtloff = false )
Moves the current abscissa back to the left margin and sets the ordinate.
If the passed value is negative, it is relative to the bottom of the page.
Moves the current abscissa back to the left margin and sets the ordinate.
If the passed value is negative, it is relative to the bottom of the page.
Parameters
- $y
- The value of the ordinate in user units.
- $resetx
- if true (default) reset the X position.
- $rtloff
- if true always uses the page top-left corner as origin of axis.
Since
1.0
See
Public
|
public
|
#
SetXY( $x, $y, $rtloff = false )
Defines the abscissa and ordinate of the current position.
If the passed values are negative, they are relative respectively to the right and bottom of the page.
Defines the abscissa and ordinate of the current position.
If the passed values are negative, they are relative respectively to the right and bottom of the page.
Parameters
- $x
- The value of the abscissa.
- $y
- The value of the ordinate.
- $rtloff
- if true always uses the page top-left corner as origin of axis.
Since
1.2
See
Public
|
public
|
#
SetAbsX( $x )
Set the absolute X coordinate of the current pointer.
Set the absolute X coordinate of the current pointer.
Parameters
- $x
- The value of the abscissa in user units.
Since
5.9.186 (2012-09-13)
See
Public
|
public
|
#
SetAbsY( $y )
Set the absolute Y coordinate of the current pointer.
Set the absolute Y coordinate of the current pointer.
Parameters
- $y
- (float) The value of the ordinate in user units.
Since
5.9.186 (2012-09-13)
See
Public
|
public
|
#
SetAbsXY( $x, $y )
Set the absolute X and Y coordinates of the current pointer.
Set the absolute X and Y coordinates of the current pointer.
Parameters
- $x
- The value of the abscissa in user units.
- $y
- (float) The value of the ordinate in user units.
Since
5.9.186 (2012-09-13)
See
Public
|
public
string
|
#
Output( $name = 'doc.pdf', $dest = 'I' )
Send the document to a given destination: string, local file or browser.
In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.
The method first calls Close() if necessary to terminate the document.
Send the document to a given destination: string, local file or browser.
In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.
The method first calls Close() if necessary to terminate the document.
Parameters
- $name
- The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.
- $dest
Destination where to send the document. It can take one of the following values:
- I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
- D: send to the browser and force a file download with the name given by name.
- F: save to a local server file with the name given by name.
- S: return the document as a string (name is ignored).
- FI: equivalent to F + I option
- FD: equivalent to F + D option
- E: return the document as base64 mime multi-part email attachment (RFC 2045)
Returns
string
Since
1.0
See
Public
|
public
|
#
_destroy( $destroyall = false, $preserve_objcopy = false )
Unset all class variables except the following critical variables.
Unset all class variables except the following critical variables.
Parameters
- $destroyall
- if true destroys all class variables, otherwise preserves critical variables.
- $preserve_objcopy
- if true preserves the objcopy variable
Since
4.5.016 (2009-02-24)
Public
|
protected
|
#
_dochecks( )
Check for locale-related bug
Check for locale-related bug
Protected
|
protected
array
|
#
getInternalPageNumberAliases( $a = '' )
Return an array containing variations for the basic page number alias.
Return an array containing variations for the basic page number alias.
Parameters
Returns
array of page number aliases
Protected
|
protected
array
|
#
getAllInternalPageNumberAliases( )
Return an array containing all internal page aliases.
Return an array containing all internal page aliases.
Returns
array of page number aliases
Protected
|
protected
replaced
|
#
replaceRightShiftPageNumAliases( $page, $aliases, $diff )
Replace right shift page number aliases with spaces to correct right alignment.
This works perfectly only when using monospaced fonts.
Replace right shift page number aliases with spaces to correct right alignment.
This works perfectly only when using monospaced fonts.
Parameters
- $page
- Page content.
- $aliases
- Array of page aliases.
- $diff
- initial difference to add.
Returns
replaced page content.
Protected
|
protected
|
#
setPageBoxTypes( $boxes )
Set page boxes to be included on page descriptions.
Set page boxes to be included on page descriptions.
Parameters
- $boxes
- Array of page boxes to set on document: ('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox').
Protected
|
protected
|
#
_putpages( )
Output pages (and replace page number aliases).
Output pages (and replace page number aliases).
Protected
|
protected
string
|
#
_getannotsrefs( $n )
Get references to page annotations.
Get references to page annotations.
Parameters
Returns
string
Author
Nicola Asuni
Since
5.0.010 (2010-05-17)
Protected
|
protected
|
#
_putannotsobjs( )
Output annotations objects for all pages.
!!! THIS METHOD IS NOT YET COMPLETED !!!
See section 12.5 of PDF 32000_2008 reference.
Output annotations objects for all pages.
!!! THIS METHOD IS NOT YET COMPLETED !!!
See section 12.5 of PDF 32000_2008 reference.
Author
Nicola Asuni
Since
4.0.018 (2008-08-06)
Protected
|
protected
integer
|
#
_putAPXObject( $w = 0, $h = 0, $stream = '' )
Put appearance streams XObject used to define annotation's appearance states.
Put appearance streams XObject used to define annotation's appearance states.
Parameters
- $w
- annotation width
- $h
- annotation height
- $stream
- appearance stream
Returns
integer object ID
Since
4.8.001 (2009-09-09)
Protected
|
protected
|
#
_putfonts( )
Output fonts.
Author
Nicola Asuni
Protected
|
protected
|
#
_puttruetypeunicode( $font )
Adds unicode fonts.
Based on PDF Reference 1.3 (section 5)
Adds unicode fonts.
Based on PDF Reference 1.3 (section 5)
Parameters
Author
Nicola Asuni
Since
1.52.0.TC005 (2005-01-05)
Protected
|
protected
|
#
_putcidfont0( $font )
Output CID-0 fonts.
A Type 0 CIDFont contains glyph descriptions based on the Adobe Type 1 font format
Output CID-0 fonts.
A Type 0 CIDFont contains glyph descriptions based on the Adobe Type 1 font format
Parameters
Author
Andrew Whitehead, Nicola Asuni, Yukihiro Nakadaira
Since
3.2.000 (2008-06-23)
Protected
|
protected
|
|
protected
|
#
_putxobjects( )
Output Form XObjects Templates.
Output Form XObjects Templates.
Author
Nicola Asuni
Since
5.8.017 (2010-08-24)
See
Protected
|
protected
|
#
_putspotcolors( )
Output Spot Colors Resources.
Output Spot Colors Resources.
Since
4.0.024 (2008-09-12)
Protected
|
protected
string
|
#
_getxobjectdict( )
Return XObjects Dictionary.
Return XObjects Dictionary.
Returns
string XObjects dictionary
Since
5.8.014 (2010-08-23)
Protected
|
protected
|
#
_putresourcedict( )
Output Resources Dictionary.
Output Resources Dictionary.
Protected
|
protected
|
|
protected
integer
|
#
_putinfo( )
Adds some Metadata information (Document Information Dictionary)
(see Chapter 14.3.3 Document Information Dictionary of PDF32000_2008.pdf Reference)
Adds some Metadata information (Document Information Dictionary)
(see Chapter 14.3.3 Document Information Dictionary of PDF32000_2008.pdf Reference)
Returns
integer object id
Protected
|
protected
(int)
|
#
_putXMP( )
Put XMP data object and return ID.
Put XMP data object and return ID.
Returns
(int) The object ID.
Since
5.9.121 (2011-09-28)
Protected
|
protected
integer
|
#
_putcatalog( )
Output Catalog.
Returns
integer object id
Protected
|
protected
string
|
#
_putviewerpreferences( )
Output viewer preferences.
Output viewer preferences.
Returns
string for viewer preferences
Author
Nicola asuni
Since
3.1.000 (2008-06-09)
Protected
|
protected
|
#
_enddoc( )
Output end of document (EOF).
Output end of document (EOF).
Protected
|
protected
|
#
_beginpage( $orientation = '', $format = '' )
Initialize a new page.
Parameters
- $orientation
page orientation. Possible values are (case insensitive):
- P or PORTRAIT (default)
- L or LANDSCAPE
- $format
- The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().
See
Protected
|
protected
|
|
protected
integer
|
#
_newobj( )
Begin a new object and return the object number.
Begin a new object and return the object number.
Returns
integer object number
Protected
|
protected
string
|
#
_getobj( $objid = '' )
Return the starting object string for the selected object ID.
Return the starting object string for the selected object ID.
Parameters
- $objid
- Object ID (leave empty to get a new ID).
Returns
string the starting object string
Since
5.8.009 (2010-08-20)
Protected
|
protected
|
#
_dounderline( $x, $y, $txt )
Underline text.
Parameters
- $x
- X coordinate
- $y
- Y coordinate
- $txt
- text to underline
Protected
|
protected
|
#
_dounderlinew( $x, $y, $w )
Underline for rectangular text area.
Underline for rectangular text area.
Parameters
- $x
- X coordinate
- $y
- Y coordinate
- $w
- width to underline
Since
4.8.008 (2009-09-29)
Protected
|
protected
|
#
_dolinethrough( $x, $y, $txt )
Line through text.
Parameters
- $x
- X coordinate
- $y
- Y coordinate
- $txt
- text to linethrough
Protected
|
protected
|
#
_dolinethroughw( $x, $y, $w )
Line through for rectangular text area.
Line through for rectangular text area.
Parameters
- $x
- X coordinate
- $y
- Y coordinate
- $w
- line length (width)
Since
4.9.008 (2009-09-29)
Protected
|
protected
|
#
_dooverline( $x, $y, $txt )
Overline text.
Parameters
- $x
- X coordinate
- $y
- Y coordinate
- $txt
- text to overline
Since
4.9.015 (2010-04-19)
Protected
|
protected
|
#
_dooverlinew( $x, $y, $w )
Overline for rectangular text area.
Overline for rectangular text area.
Parameters
- $x
- X coordinate
- $y
- Y coordinate
- $w
- width to overline
Since
4.9.015 (2010-04-19)
Protected
|
protected
string
|
#
_datastring( $s, $n = 0 )
Format a data string for meta information
Format a data string for meta information
Parameters
- $s
- data string to escape.
- $n
- object ID
Returns
string escaped string.
Protected
|
public
|
#
setDocCreationTimestamp( $time )
Set the document creation timestamp
Set the document creation timestamp
Parameters
- $time
- Document creation timestamp in seconds or date-time string.
Since
5.9.152 (2012-03-23)
Public
|
public
|
#
setDocModificationTimestamp( $time )
Set the document modification timestamp
Set the document modification timestamp
Parameters
- $time
- Document modification timestamp in seconds or date-time string.
Since
5.9.152 (2012-03-23)
Public
|
public
(int)
|
#
getDocCreationTimestamp( )
Returns document creation timestamp in seconds.
Returns document creation timestamp in seconds.
Returns
(int) Creation timestamp in seconds.
Since
5.9.152 (2012-03-23)
Public
|
public
(int)
|
#
getDocModificationTimestamp( )
Returns document modification timestamp in seconds.
Returns document modification timestamp in seconds.
Returns
(int) Modfication timestamp in seconds.
Since
5.9.152 (2012-03-23)
Public
|
protected
string
|
#
_datestring( $n = 0, $timestamp = 0 )
Returns a formatted date for meta information
Returns a formatted date for meta information
Parameters
- $n
- Object ID.
- $timestamp
- Timestamp to convert.
Returns
string escaped date string.
Since
4.6.028 (2009-08-25)
Protected
|
protected
string
|
#
_textstring( $s, $n = 0 )
Format a text string for meta information
Format a text string for meta information
Parameters
- $s
- string to escape.
- $n
- object ID
Returns
string escaped string.
Protected
|
protected
|
#
_getrawstream( $s, $n = 0 )
get raw output stream.
Parameters
- $s
- string to output.
- $n
- object reference for encryption mode
Author
Nicola Asuni
Since
5.5.000 (2010-06-22)
Protected
|
protected
|
#
_out( $s )
Output a string to the document.
Output a string to the document.
Parameters
Protected
|
public
|
|
public
|
|
public
the
|
#
addHtmlLink( $url, $name, $fill = false, $firstline = false, $color = '', $style = -1, $firstblock = false )
Output anchor link.
Parameters
- $url
- link URL or internal link (i.e.: <a href="#23,4.5">link to page 23 at 4.5 Y position</a>)
- $name
- link name
- $fill
- Indicates if the cell background must be painted (true) or transparent (false).
- $firstline
- if true prints only the first line and return the remaining string.
- $color
- array of RGB text color
- $style
- font style (U, D, B, I)
- $firstblock
- if true the string is the starting of a line.
Returns
the number of cells used or the remaining text if $firstline = true;
Public
|
public
float
|
#
pixelsToUnits( $px )
Converts pixels to User's Units.
Converts pixels to User's Units.
Parameters
Returns
float value in user's unit
See
Public
|
public
string
|
#
unhtmlentities( $text_to_convert )
Reverse function for htmlentities.
Convert entities in UTF-8.
Reverse function for htmlentities.
Convert entities in UTF-8.
Parameters
- $text_to_convert
- Text to convert.
Returns
string converted text string
Public
|
protected
integer
|
#
_objectkey( $n )
Compute encryption key depending on object number where the encrypted data is stored.
This is used for all strings and streams without crypt filter specifier.
Compute encryption key depending on object number where the encrypted data is stored.
This is used for all strings and streams without crypt filter specifier.
Parameters
Returns
integer object key
Author
Nicola Asuni
Since
2.0.000 (2008-01-02)
Protected
|
protected
TCPDF::$encrypted
|
#
_encrypt_data( $n, $s )
Encrypt the input string.
Encrypt the input string.
Parameters
- $n
- object number
- $s
- data string to encrypt
Returns
Author
Nicola Asuni
Since
5.0.005 (2010-05-11)
Protected
|
protected
|
#
_putencryption( )
Put encryption on PDF document.
Put encryption on PDF document.
Author
Nicola Asuni
Since
2.0.000 (2008-01-02)
Protected
|
protected
string
|
#
_Uvalue( )
Compute U value (used for encryption)
Compute U value (used for encryption)
Returns
string U value
Author
Nicola Asuni
Since
2.0.000 (2008-01-02)
Protected
|
protected
string
|
#
_UEvalue( )
Compute UE value (used for encryption)
Compute UE value (used for encryption)
Returns
string UE value
Author
Nicola Asuni
Since
5.9.006 (2010-10-19)
Protected
|
protected
string
|
#
_Ovalue( )
Compute O value (used for encryption)
Compute O value (used for encryption)
Returns
string O value
Author
Nicola Asuni
Since
2.0.000 (2008-01-02)
Protected
|
protected
string
|
#
_OEvalue( )
Compute OE value (used for encryption)
Compute OE value (used for encryption)
Returns
string OE value
Author
Nicola Asuni
Since
5.9.006 (2010-10-19)
Protected
|
protected
string
|
#
_fixAES256Password( $password )
Convert password for AES-256 encryption mode
Convert password for AES-256 encryption mode
Parameters
Returns
string password
Author
Nicola Asuni
Since
5.9.006 (2010-10-19)
Protected
|
protected
|
|
public
|
#
SetProtection( $permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), $user_pass = '', $owner_pass = null, $mode = 0, $pubkeys = null )
Set document protection
Remark: the protection against modification is for people who have the full Acrobat product.
If you don't set any password, the document will open as usual. If you set a user password, the PDF viewer will ask for it before displaying the document. The master password, if different from the user one, can be used to get full access.
Note: protecting a document requires to encrypt it, which increases the processing time a lot. This can cause a PHP time-out in some cases, especially if the document contains images or fonts.
Set document protection
Remark: the protection against modification is for people who have the full Acrobat product.
If you don't set any password, the document will open as usual. If you set a user password, the PDF viewer will ask for it before displaying the document. The master password, if different from the user one, can be used to get full access.
Note: protecting a document requires to encrypt it, which increases the processing time a lot. This can cause a PHP time-out in some cases, especially if the document contains images or fonts.
Parameters
- $permissions
the set of permissions (specify the ones you want to block):
- print : Print the document;
- modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
- copy : Copy or otherwise extract text and graphics from the document;
- annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields);
- fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified;
- extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes);
- assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set;
- print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
- owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
- $user_pass
- user password. Empty by default.
- $owner_pass
- owner password. If not specified, a random value is used.
- $mode
- encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit.
- $pubkeys
- array of recipients containing public-key certificates ('c') and permissions ('p'). For example: array(array('c' => 'file://../examples/data/cert/tcpdf.crt', 'p' => array('print')))
Author
Nicola Asuni
Since
2.0.000 (2008-01-02)
Public
|
public
|
#
StartTransform( )
Starts a 2D tranformation saving current graphic state.
This function must be called before scaling, mirroring, translation, rotation and skewing.
Use StartTransform() before, and StopTransform() after the transformations to restore the normal behavior.
Starts a 2D tranformation saving current graphic state.
This function must be called before scaling, mirroring, translation, rotation and skewing.
Use StartTransform() before, and StopTransform() after the transformations to restore the normal behavior.
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
StopTransform( )
Stops a 2D tranformation restoring previous graphic state.
This function must be called after scaling, mirroring, translation, rotation and skewing.
Use StartTransform() before, and StopTransform() after the transformations to restore the normal behavior.
Stops a 2D tranformation restoring previous graphic state.
This function must be called after scaling, mirroring, translation, rotation and skewing.
Use StartTransform() before, and StopTransform() after the transformations to restore the normal behavior.
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
ScaleX( $s_x, $x = '', $y = '' )
Horizontal Scaling.
Parameters
- $s_x
- scaling factor for width as percent. 0 is not allowed.
- $x
- abscissa of the scaling center. Default is current x position
- $y
- ordinate of the scaling center. Default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
ScaleY( $s_y, $x = '', $y = '' )
Vertical Scaling.
Parameters
- $s_y
- scaling factor for height as percent. 0 is not allowed.
- $x
- abscissa of the scaling center. Default is current x position
- $y
- ordinate of the scaling center. Default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
ScaleXY( $s, $x = '', $y = '' )
Vertical and horizontal proportional Scaling.
Vertical and horizontal proportional Scaling.
Parameters
- $s
- scaling factor for width and height as percent. 0 is not allowed.
- $x
- abscissa of the scaling center. Default is current x position
- $y
- ordinate of the scaling center. Default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
Scale( $s_x, $s_y, $x = '', $y = '' )
Vertical and horizontal non-proportional Scaling.
Vertical and horizontal non-proportional Scaling.
Parameters
- $s_x
- scaling factor for width as percent. 0 is not allowed.
- $s_y
- scaling factor for height as percent. 0 is not allowed.
- $x
- abscissa of the scaling center. Default is current x position
- $y
- ordinate of the scaling center. Default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
MirrorH( $x = '' )
Horizontal Mirroring.
Parameters
- $x
- abscissa of the point. Default is current x position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
MirrorV( $y = '' )
Verical Mirroring.
Parameters
- $y
- ordinate of the point. Default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
MirrorP( $x = '', $y = '' )
Point reflection mirroring.
Point reflection mirroring.
Parameters
- $x
- abscissa of the point. Default is current x position
- $y
- ordinate of the point. Default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
MirrorL( $angle = 0, $x = '', $y = '' )
Reflection against a straight line through point (x, y) with the gradient angle (angle).
Reflection against a straight line through point (x, y) with the gradient angle (angle).
Parameters
- $angle
- gradient angle of the straight line. Default is 0 (horizontal line).
- $x
- abscissa of the point. Default is current x position
- $y
- ordinate of the point. Default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
TranslateX( $t_x )
Translate graphic object horizontally.
Translate graphic object horizontally.
Parameters
- $t_x
- movement to the right (or left for RTL)
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
TranslateY( $t_y )
Translate graphic object vertically.
Translate graphic object vertically.
Parameters
- $t_y
- movement to the bottom
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
Translate( $t_x, $t_y )
Translate graphic object horizontally and vertically.
Translate graphic object horizontally and vertically.
Parameters
- $t_x
- movement to the right
- $t_y
- movement to the bottom
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
Rotate( $angle, $x = '', $y = '' )
Rotate object.
Parameters
- $angle
- angle in degrees for counter-clockwise rotation
- $x
- abscissa of the rotation center. Default is current x position
- $y
- ordinate of the rotation center. Default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
SkewX( $angle_x, $x = '', $y = '' )
Skew horizontally.
Parameters
- $angle_x
- angle in degrees between -90 (skew to the left) and 90 (skew to the right)
- $x
- abscissa of the skewing center. default is current x position
- $y
- ordinate of the skewing center. default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
SkewY( $angle_y, $x = '', $y = '' )
Skew vertically.
Parameters
- $angle_y
- angle in degrees between -90 (skew to the bottom) and 90 (skew to the top)
- $x
- abscissa of the skewing center. default is current x position
- $y
- ordinate of the skewing center. default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
public
|
#
Skew( $angle_x, $angle_y, $x = '', $y = '' )
Skew.
Parameters
- $angle_x
- angle in degrees between -90 (skew to the left) and 90 (skew to the right)
- $angle_y
- angle in degrees between -90 (skew to the bottom) and 90 (skew to the top)
- $x
- abscissa of the skewing center. default is current x position
- $y
- ordinate of the skewing center. default is current y position
Since
2.1.000 (2008-01-07)
See
Public
|
protected
|
#
Transform( $tm )
Apply graphic transformations.
Apply graphic transformations.
Parameters
- $tm
- transformation matrix
Since
2.1.000 (2008-01-07)
See
Protected
|
public
|
#
SetLineWidth( $width )
Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.
Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.
Parameters
Since
1.0
See
Public
|
public
integer
|
#
GetLineWidth( )
Returns the current the line width.
Returns the current the line width.
Returns
integer Line width
Since
2.1.000 (2008-01-07)
See
Public
|
public
string
|
#
SetLineStyle( $style, $ret = false )
Set line style.
Parameters
- $style
Line style. Array with keys among the following:
- width (float): Width of the line in user units.
- cap (string): Type of cap to put on the line. Possible values are:
butt, round, square. The difference between "square" and "butt" is that
"square" projects a flat end past the end of the line.
- join (string): Type of join. Possible values are: miter, round,
bevel.
- dash (mixed): Dash pattern. Is 0 (without dash) or string with
series of length values, which are the lengths of the on and off dashes.
For example: "2" represents 2 on, 2 off, 2 on, 2 off, ...; "2,1" is 2 on,
1 off, 2 on, 1 off, ...
- phase (integer): Modifier on the dash pattern which is used to shift
the point at which the pattern starts.
- color (array): Draw color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName).
- $ret
- if true do not send the command.
Returns
string the PDF command
Since
2.1.000 (2008-01-08)
Public
|
protected
|
#
_outPoint( $x, $y )
Begin a new subpath by moving the current point to coordinates (x, y), omitting any connecting line segment.
Begin a new subpath by moving the current point to coordinates (x, y), omitting any connecting line segment.
Parameters
- $x
- Abscissa of point.
- $y
- Ordinate of point.
Since
2.1.000 (2008-01-08)
Protected
|
protected
|
#
_outLine( $x, $y )
Append a straight line segment from the current point to the point (x, y).
The new current point shall be (x, y).
Append a straight line segment from the current point to the point (x, y).
The new current point shall be (x, y).
Parameters
- $x
- Abscissa of end point.
- $y
- Ordinate of end point.
Since
2.1.000 (2008-01-08)
Protected
|
protected
|
#
_outRect( $x, $y, $w, $h, $op )
Append a rectangle to the current path as a complete subpath, with lower-left corner (x, y) and dimensions widthand height in user space.
Append a rectangle to the current path as a complete subpath, with lower-left corner (x, y) and dimensions widthand height in user space.
Parameters
- $x
- Abscissa of upper-left corner.
- $y
- Ordinate of upper-left corner.
- $w
- Width.
- $h
- Height.
- $op
- options
Since
2.1.000 (2008-01-08)
Protected
|
protected
|
#
_outCurve( $x1, $y1, $x2, $y2, $x3, $y3 )
Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as the Bezier control points.
The new current point shall be (x3, y3).
Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as the Bezier control points.
The new current point shall be (x3, y3).
Parameters
- $x1
- Abscissa of control point 1.
- $y1
- Ordinate of control point 1.
- $x2
- Abscissa of control point 2.
- $y2
- Ordinate of control point 2.
- $x3
- Abscissa of end point.
- $y3
- Ordinate of end point.
Since
2.1.000 (2008-01-08)
Protected
|
protected
|
#
_outCurveV( $x2, $y2, $x3, $y3 )
Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using the current point and (x2, y2) as the Bezier control points.
The new current point shall be (x3, y3).
Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using the current point and (x2, y2) as the Bezier control points.
The new current point shall be (x3, y3).
Parameters
- $x2
- Abscissa of control point 2.
- $y2
- Ordinate of control point 2.
- $x3
- Abscissa of end point.
- $y3
- Ordinate of end point.
Since
4.9.019 (2010-04-26)
Protected
|
protected
|
#
_outCurveY( $x1, $y1, $x3, $y3 )
Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the Bezier control points.
The new current point shall be (x3, y3).
Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the Bezier control points.
The new current point shall be (x3, y3).
Parameters
- $x1
- Abscissa of control point 1.
- $y1
- Ordinate of control point 1.
- $x3
- Abscissa of end point.
- $y3
- Ordinate of end point.
Since
2.1.000 (2008-01-08)
Protected
|
public
|
#
Line( $x1, $y1, $x2, $y2, $style = array() )
Draws a line between two points.
Draws a line between two points.
Parameters
- $x1
- Abscissa of first point.
- $y1
- Ordinate of first point.
- $x2
- Abscissa of second point.
- $y2
- Ordinate of second point.
- $style
- Line style. Array like for SetLineStyle(). Default value: default line style (empty array).
Since
1.0
See
Public
|
public
|
#
Rect( $x, $y, $w, $h, $style = '', $border_style = array(), $fill_color = array() )
Draws a rectangle.
Parameters
- $x
- Abscissa of upper-left corner.
- $y
- Ordinate of upper-left corner.
- $w
- Width.
- $h
- Height.
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $border_style
Border style of rectangle. Array with keys among the following:
- all: Line style of all borders. Array like for SetLineStyle().
- L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for SetLineStyle().
If a key is not present or is null, the correspondent border is not drawn. Default value: default line style (empty array).
- $fill_color
- Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).
Since
1.0
See
Public
|
public
|
#
Curve( $x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, $style = '', $line_style = array(), $fill_color = array() )
Draws a Bezier curve.
The Bezier curve is a tangent to the line between the control points at
either end of the curve.
Draws a Bezier curve.
The Bezier curve is a tangent to the line between the control points at
either end of the curve.
Parameters
- $x0
- Abscissa of start point.
- $y0
- Ordinate of start point.
- $x1
- Abscissa of control point 1.
- $y1
- Ordinate of control point 1.
- $x2
- Abscissa of control point 2.
- $y2
- Ordinate of control point 2.
- $x3
- Abscissa of end point.
- $y3
- Ordinate of end point.
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $line_style
- Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array).
- $fill_color
- Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).
Since
2.1.000 (2008-01-08)
See
Public
|
public
|
#
Polycurve( $x0, $y0, $segments, $style = '', $line_style = array(), $fill_color = array() )
Draws a poly-Bezier curve.
Each Bezier curve segment is a tangent to the line between the control points at
either end of the curve.
Draws a poly-Bezier curve.
Each Bezier curve segment is a tangent to the line between the control points at
either end of the curve.
Parameters
- $x0
- Abscissa of start point.
- $y0
- Ordinate of start point.
- $segments
- An array of bezier descriptions. Format: array(x1, y1, x2, y2, x3, y3).
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $line_style
- Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array).
- $fill_color
- Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).
Since
3.0008 (2008-05-12)
See
Public
|
public
|
#
Ellipse( $x0, $y0, $rx, $ry = '', $angle = 0, $astart = 0, $afinish = 360, $style = '', $line_style = array(), $fill_color = array(), $nc = 2 )
Draws an ellipse.
An ellipse is formed from n Bezier curves.
Draws an ellipse.
An ellipse is formed from n Bezier curves.
Parameters
- $x0
- Abscissa of center point.
- $y0
- Ordinate of center point.
- $rx
- Horizontal radius.
- $ry
- Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0.
- $angle
- Angle oriented (anti-clockwise). Default value: 0.
- $astart
- Angle start of draw line. Default value: 0.
- $afinish
- Angle finish of draw line. Default value: 360.
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $line_style
- Line style of ellipse. Array like for SetLineStyle(). Default value: default line style (empty array).
- $fill_color
- Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).
- $nc
- Number of curves used to draw a 90 degrees portion of ellipse.
Author
Nicola Asuni
Since
2.1.000 (2008-01-08)
Public
|
protected
array
|
#
_outellipticalarc( $xc, $yc, $rx, $ry, $xang = 0, $angs = 0, $angf = 360, $pie = false, $nc = 2, $startpoint = true, $ccw = true, $svg = false )
Append an elliptical arc to the current path.
An ellipse is formed from n Bezier curves.
Append an elliptical arc to the current path.
An ellipse is formed from n Bezier curves.
Parameters
- $xc
- Abscissa of center point.
- $yc
- Ordinate of center point.
- $rx
- Horizontal radius.
- $ry
- Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0.
- $xang
- Angle between the X-axis and the major axis of the ellipse. Default value: 0.
- $angs
- Angle start of draw line. Default value: 0.
- $angf
- Angle finish of draw line. Default value: 360.
- $pie
- if true do not mark the border point (used to draw pie sectors).
- $nc
- Number of curves used to draw a 90 degrees portion of ellipse.
- $startpoint
- if true output a starting point.
- $ccw
- if true draws in counter-clockwise.
- $svg
- if true the angles are in svg mode (already calculated).
Returns
array bounding box coordinates (x min, y min, x max, y max)
Author
Nicola Asuni
Since
4.9.019 (2010-04-26)
Protected
|
public
|
#
Circle( $x0, $y0, $r, $angstr = 0, $angend = 360, $style = '', $line_style = array(), $fill_color = array(), $nc = 2 )
Draws a circle.
A circle is formed from n Bezier curves.
Draws a circle.
A circle is formed from n Bezier curves.
Parameters
- $x0
- Abscissa of center point.
- $y0
- Ordinate of center point.
- $r
- Radius.
- $angstr
- Angle start of draw line. Default value: 0.
- $angend
- Angle finish of draw line. Default value: 360.
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $line_style
- Line style of circle. Array like for SetLineStyle(). Default value: default line style (empty array).
- $fill_color
- Fill color. Format: array(red, green, blue). Default value: default color (empty array).
- $nc
- Number of curves used to draw a 90 degrees portion of circle.
Since
2.1.000 (2008-01-08)
Public
|
public
|
#
PolyLine( $p, $style = '', $line_style = array(), $fill_color = array() )
Draws a polygonal line
Parameters
- $p
- Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1))
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $line_style
Line style of polygon. Array with keys among the following:
- all: Line style of all lines. Array like for SetLineStyle().
- 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
If a key is not present or is null, not draws the line. Default value is default line style (empty array).
- $fill_color
- Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).
Since
4.8.003 (2009-09-15)
Public
|
public
|
#
Polygon( $p, $style = '', $line_style = array(), $fill_color = array(), $closed = true )
Draws a polygon.
Parameters
- $p
- Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1))
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $line_style
Line style of polygon. Array with keys among the following:
- all: Line style of all lines. Array like for SetLineStyle().
- 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
If a key is not present or is null, not draws the line. Default value is default line style (empty array).
- $fill_color
- Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).
- $closed
- if true the polygon is closes, otherwise will remain open
Since
2.1.000 (2008-01-08)
Public
|
public
|
#
RegularPolygon( $x0, $y0, $r, $ns, $angle = 0, $draw_circle = false, $style = '', $line_style = array(), $fill_color = array(), $circle_style = '', $circle_outLine_style = array(), $circle_fill_color = array() )
Draws a regular polygon.
Parameters
- $x0
- Abscissa of center point.
- $y0
- Ordinate of center point.
- $r
- Radius of inscribed circle.
- $ns
- Number of sides.
- $angle
- Angle oriented (anti-clockwise). Default value: 0.
- $draw_circle
- Draw inscribed circle or not. Default value: false.
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $line_style
Line style of polygon sides. Array with keys among the following:
- all: Line style of all sides. Array like for SetLineStyle().
- 0 to ($ns - 1): Line style of each side. Array like for SetLineStyle().
If a key is not present or is null, not draws the side. Default value is default line style (empty array).
- $fill_color
- Fill color. Format: array(red, green, blue). Default value: default color (empty array).
- $circle_style
Style of rendering of inscribed circle (if draws). Possible values are:
- D or empty string: Draw (default).
- F: Fill.
- DF or FD: Draw and fill.
- CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
- CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
- $circle_outLine_style
- Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array).
- $circle_fill_color
- Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array).
Since
2.1.000 (2008-01-08)
Public
|
public
|
#
StarPolygon( $x0, $y0, $r, $nv, $ng, $angle = 0, $draw_circle = false, $style = '', $line_style = array(), $fill_color = array(), $circle_style = '', $circle_outLine_style = array(), $circle_fill_color = array() )
Draws a star polygon
Parameters
- $x0
- Abscissa of center point.
- $y0
- Ordinate of center point.
- $r
- Radius of inscribed circle.
- $nv
- Number of vertices.
- $ng
- Number of gap (if ($ng % $nv = 1) then is a regular polygon).
- $angle
- Angle oriented (anti-clockwise). Default value: 0.
- $draw_circle
- Draw inscribed circle or not. Default value is false.
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $line_style
Line style of polygon sides. Array with keys among the following:
- all: Line style of all sides. Array like for
SetLineStyle().
- 0 to (n - 1): Line style of each side. Array like for SetLineStyle().
If a key is not present or is null, not draws the side. Default value is default line style (empty array).
- $fill_color
- Fill color. Format: array(red, green, blue). Default value: default color (empty array).
- $circle_style
Style of rendering of inscribed circle (if draws). Possible values are:
- D or empty string: Draw (default).
- F: Fill.
- DF or FD: Draw and fill.
- CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
- CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
- $circle_outLine_style
- Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array).
- $circle_fill_color
- Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array).
Since
2.1.000 (2008-01-08)
Public
|
public
|
#
RoundedRect( $x, $y, $w, $h, $r, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array() )
Draws a rounded rectangle.
Draws a rounded rectangle.
Parameters
- $x
- Abscissa of upper-left corner.
- $y
- Ordinate of upper-left corner.
- $w
- Width.
- $h
- Height.
- $r
- the radius of the circle used to round off the corners of the rectangle.
- $round_corner
- Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111").
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $border_style
- Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array).
- $fill_color
- Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).
Since
2.1.000 (2008-01-08)
Public
|
public
|
#
RoundedRectXY( $x, $y, $w, $h, $rx, $ry, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array() )
Draws a rounded rectangle.
Draws a rounded rectangle.
Parameters
- $x
- Abscissa of upper-left corner.
- $y
- Ordinate of upper-left corner.
- $w
- Width.
- $h
- Height.
- $rx
- the x-axis radius of the ellipse used to round off the corners of the rectangle.
- $ry
- the y-axis radius of the ellipse used to round off the corners of the rectangle.
- $round_corner
- Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111").
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $border_style
- Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array).
- $fill_color
- Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).
Since
4.9.019 (2010-04-22)
Public
|
public
|
#
Arrow( $x0, $y0, $x1, $y1, $head_style = 0, $arm_size = 5, $arm_angle = 15 )
Draws a grahic arrow.
Parameters
- $x0
- Abscissa of first point.
- $y0
- Ordinate of first point.
- $x1
- Abscissa of second point.
- $y1
- Ordinate of second point.
- $head_style
- (0 = draw only arrowhead arms, 1 = draw closed arrowhead, but no fill, 2 = closed and filled arrowhead, 3 = filled arrowhead)
- $arm_size
- length of arrowhead arms
- $arm_angle
- angle between an arm and the shaft
Author
Piotr Galecki, Nicola Asuni, Andy Meier
Since
4.6.018 (2009-07-10)
|
public
(string)
|
#
setDestination( $name, $y = -1, $page = '', $x = -1 )
Add a Named Destination.
NOTE: destination names are unique, so only last entry will be saved.
Add a Named Destination.
NOTE: destination names are unique, so only last entry will be saved.
Parameters
- $name
- Destination name.
- $y
- Y position in user units of the destiantion on the selected page (default = -1 = current position; 0 = page start;).
- $page
- Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.
- $x
- X position in user units of the destiantion on the selected page (default = -1 = current position;).
Returns
(string) Stripped named destination identifier or false in case of error.
Author
Christian Deligant, Nicola Asuni
Since
5.9.097 (2011-06-23)
Public
|
public
(array)
|
#
getDestination( )
Return the Named Destination array.
Return the Named Destination array.
Returns
(array) Named Destination array.
Author
Nicola Asuni
Since
5.9.097 (2011-06-23)
Public
|
protected
|
#
_putdests( )
Insert Named Destinations.
Insert Named Destinations.
Author
Johannes G\FCntert, Nicola Asuni
Since
5.9.098 (2011-06-23)
Protected
|
public
|
#
setBookmark( $txt, $level = 0, $y = -1, $page = '', $style = '', $color = array(0,0,0), $x = -1, $link = '' )
Adds a bookmark - alias for Bookmark().
Adds a bookmark - alias for Bookmark().
Parameters
- $txt
- Bookmark description.
- $level
- Bookmark level (minimum value is 0).
- $y
- Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;).
- $page
- Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.
- $style
- Font style: B = Bold, I = Italic, BI = Bold + Italic.
- $color
- RGB color array (values from 0 to 255).
- $x
- X position in user units of the bookmark on the selected page (default = -1 = current position;).
- $link
- URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name).
Public
|
public
|
#
Bookmark( $txt, $level = 0, $y = -1, $page = '', $style = '', $color = array(0,0,0), $x = -1, $link = '' )
Adds a bookmark.
Parameters
- $txt
- Bookmark description.
- $level
- Bookmark level (minimum value is 0).
- $y
- Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;).
- $page
- Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.
- $style
- Font style: B = Bold, I = Italic, BI = Bold + Italic.
- $color
- RGB color array (values from 0 to 255).
- $x
- X position in user units of the bookmark on the selected page (default = -1 = current position;).
- $link
- URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name).
Since
2.1.002 (2008-02-12)
Public
|
protected
|
#
sortBookmarks( )
Sort bookmarks for page and key.
Sort bookmarks for page and key.
Since
5.9.119 (2011-09-19)
Protected
|
protected
|
#
_putbookmarks( )
Create a bookmark PDF string.
Create a bookmark PDF string.
Author
Olivier Plathey, Nicola Asuni
Since
2.1.002 (2008-02-12)
Protected
|
public
|
#
IncludeJS( $script )
Adds a javascript
Parameters
Author
Johannes G\FCntert, Nicola Asuni
Since
2.1.002 (2008-02-12)
Public
|
public
integer
|
#
addJavascriptObject( $script, $onload = false )
Adds a javascript object and return object ID
Adds a javascript object and return object ID
Parameters
- $script
- Javascript code
- $onload
- if true executes this object when opening the document
Returns
integer internal object ID
Author
Nicola Asuni
Since
4.8.000 (2009-09-07)
Public
|
protected
|
#
_putjavascript( )
Create a javascript PDF string.
Create a javascript PDF string.
Author
Johannes G\FCntert, Nicola Asuni
Since
2.1.002 (2008-02-12)
Protected
|
protected
|
#
_addfield( $type, $name, $x, $y, $w, $h, $prop )
Adds a javascript form field.
Adds a javascript form field.
Parameters
- $type
- field type
- $name
- field name
- $x
- horizontal position
- $y
- vertical position
- $w
- width
- $h
- height
- $prop
- javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
Author
Denis Van Nuffelen, Nicola Asuni
Since
2.1.002 (2008-02-12)
Protected
|
public
|
#
setFormDefaultProp( $prop = array() )
Set default properties for form fields.
Set default properties for form fields.
Parameters
- $prop
- javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
Author
Nicola Asuni
Since
4.8.000 (2009-09-06)
Public
|
public
array
|
#
getFormDefaultProp( )
Return the default properties for form fields.
Return the default properties for form fields.
Returns
array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
Author
Nicola Asuni
Since
4.8.000 (2009-09-06)
Public
|
public
|
#
TextField( $name, $w, $h, $prop = array(), $opt = array(), $x = '', $y = '', $js = false )
Creates a text field
Parameters
- $name
- field name
- $w
- Width of the rectangle
- $h
- Height of the rectangle
- $prop
- javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
- $opt
- annotation parameters. Possible values are described on official PDF32000_2008 reference.
- $x
- Abscissa of the upper-left corner of the rectangle
- $y
- Ordinate of the upper-left corner of the rectangle
- $js
- if true put the field using JavaScript (requires Acrobat Writer to be rendered).
Author
Nicola Asuni
Since
4.8.000 (2009-09-07)
Public
|
public
|
#
RadioButton( $name, $w, $prop = array(), $opt = array(), $onvalue = 'On', $checked = false, $x = '', $y = '', $js = false )
Creates a RadioButton field.
Creates a RadioButton field.
Parameters
- $name
- Field name.
- $w
- Width of the radio button.
- $prop
- Javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
- $opt
- Annotation parameters. Possible values are described on official PDF32000_2008 reference.
- $onvalue
- Value to be returned if selected.
- $checked
- Define the initial state.
- $x
- Abscissa of the upper-left corner of the rectangle
- $y
- Ordinate of the upper-left corner of the rectangle
- $js
- If true put the field using JavaScript (requires Acrobat Writer to be rendered).
Author
Nicola Asuni
Since
4.8.000 (2009-09-07)
Public
|
public
|
#
ListBox( $name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false )
Creates a List-box field
Parameters
- $name
- field name
- $w
- width
- $h
- height
- $values
- array containing the list of values.
- $prop
- javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
- $opt
- annotation parameters. Possible values are described on official PDF32000_2008 reference.
- $x
- Abscissa of the upper-left corner of the rectangle
- $y
- Ordinate of the upper-left corner of the rectangle
- $js
- if true put the field using JavaScript (requires Acrobat Writer to be rendered).
Author
Nicola Asuni
Since
4.8.000 (2009-09-07)
Public
|
public
|
#
ComboBox( $name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false )
Creates a Combo-box field
Creates a Combo-box field
Parameters
- $name
- field name
- $w
- width
- $h
- height
- $values
- array containing the list of values.
- $prop
- javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
- $opt
- annotation parameters. Possible values are described on official PDF32000_2008 reference.
- $x
- Abscissa of the upper-left corner of the rectangle
- $y
- Ordinate of the upper-left corner of the rectangle
- $js
- if true put the field using JavaScript (requires Acrobat Writer to be rendered).
Author
Nicola Asuni
Since
4.8.000 (2009-09-07)
Public
|
public
|
#
CheckBox( $name, $w, $checked = false, $prop = array(), $opt = array(), $onvalue = 'Yes', $x = '', $y = '', $js = false )
Creates a CheckBox field
Parameters
- $name
- field name
- $w
- width
- $checked
- define the initial state.
- $prop
- javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
- $opt
- annotation parameters. Possible values are described on official PDF32000_2008 reference.
- $onvalue
- value to be returned if selected.
- $x
- Abscissa of the upper-left corner of the rectangle
- $y
- Ordinate of the upper-left corner of the rectangle
- $js
- if true put the field using JavaScript (requires Acrobat Writer to be rendered).
Author
Nicola Asuni
Since
4.8.000 (2009-09-07)
Public
|
public
|
#
Button( $name, $w, $h, $caption, $action, $prop = array(), $opt = array(), $x = '', $y = '', $js = false )
Creates a button field
Parameters
- $name
- field name
- $w
- width
- $h
- height
- $caption
- caption.
- $action
- action triggered by pressing the button. Use a string to specify a javascript action. Use an array to specify a form action options as on section 12.7.5 of PDF32000_2008.
- $prop
- javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
- $opt
- annotation parameters. Possible values are described on official PDF32000_2008 reference.
- $x
- Abscissa of the upper-left corner of the rectangle
- $y
- Ordinate of the upper-left corner of the rectangle
- $js
- if true put the field using JavaScript (requires Acrobat Writer to be rendered).
Author
Nicola Asuni
Since
4.8.000 (2009-09-07)
Public
|
protected
|
#
_putsignature( )
Add certification signature (DocMDP or UR3)
You can set only one signature type
Add certification signature (DocMDP or UR3)
You can set only one signature type
Author
Nicola Asuni
Since
4.6.008 (2009-05-07)
Protected
|
public
|
#
setUserRights( $enable = true, $document = '/FullSave', $annots = '/Create/Delete/Modify/Copy/Import/Export', $form = '/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate', $signature = '/Modify', $ef = '/Create/Delete/Modify/Import', $formex = '' )
Set User's Rights for PDF Reader
WARNING: This is experimental and currently do not work.
Check the PDF Reference 8.7.1 Transform Methods,
Table 8.105 Entries in the UR transform parameters dictionary
Set User's Rights for PDF Reader
WARNING: This is experimental and currently do not work.
Check the PDF Reference 8.7.1 Transform Methods,
Table 8.105 Entries in the UR transform parameters dictionary
Parameters
- $enable
- if true enable user's rights on PDF reader
- $document
- Names specifying additional document-wide usage rights for the document. The only defined value is "/FullSave", which permits a user to save the document along with modified form and/or annotation data.
- $annots
- Names specifying additional annotation-related usage rights for the document. Valid names in PDF 1.5 and later are /Create/Delete/Modify/Copy/Import/Export, which permit the user to perform the named operation on annotations.
- $form
- Names specifying additional form-field-related usage rights for the document. Valid names are: /Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate
- $signature
- Names specifying additional signature-related usage rights for the document. The only defined value is /Modify, which permits a user to apply a digital signature to an existing signature form field or clear a signed signature form field.
- $ef
Names specifying additional usage rights for named embedded files in the document. Valid names are /Create/Delete/Modify/Import, which permit the user to perform the named operation on named embedded files
Names specifying additional embedded-files-related usage rights for the document.
- $formex
- Names specifying additional form-field-related usage rights. The only valid name is BarcodePlaintext, which permits text form field data to be encoded as a plaintext two-dimensional barcode.
Author
Nicola Asuni
Since
2.9.000 (2008-03-26)
Public
|
public
|
#
setSignature( $signing_cert = '', $private_key = '', $private_key_password = '', $extracerts = '', $cert_type = 2, $info = array(), $approval = '' )
Enable document signature (requires the OpenSSL Library).
The digital signature improve document authenticity and integrity and allows o enable extra features on Acrobat Reader.
To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt
To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12
To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes
Enable document signature (requires the OpenSSL Library).
The digital signature improve document authenticity and integrity and allows o enable extra features on Acrobat Reader.
To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt
To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12
To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes
Parameters
- $signing_cert
- signing certificate (string or filename prefixed with 'file://')
- $private_key
- private key (string or filename prefixed with 'file://')
- $private_key_password
- password
- $extracerts
- specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used.
- $cert_type
- The access permissions granted for this document. Valid values shall be: 1 = No changes to the document shall be permitted; any change to the document shall invalidate the signature; 2 = Permitted changes shall be filling in forms, instantiating page templates, and signing; other changes shall invalidate the signature; 3 = Permitted changes shall be the same as for 2, as well as annotation creation, deletion, and modification; other changes shall invalidate the signature.
- $info
- array of option information: Name, Location, Reason, ContactInfo.
- $approval
- Enable approval signature eg. for PDF incremental update
Author
Nicola Asuni
Since
4.6.005 (2009-04-24)
Public
|
public
|
#
setSignatureAppearance( $x = 0, $y = 0, $w = 0, $h = 0, $page = -1, $name = '' )
Set the digital signature appearance (a cliccable rectangle area to get signature properties)
Set the digital signature appearance (a cliccable rectangle area to get signature properties)
Parameters
- $x
- Abscissa of the upper-left corner.
- $y
- Ordinate of the upper-left corner.
- $w
- Width of the signature area.
- $h
- Height of the signature area.
- $page
- option page number (if < 0 the current page is used).
- $name
- Name of the signature.
Author
Nicola Asuni
Since
5.3.011 (2010-06-17)
Public
|
public
|
#
addEmptySignatureAppearance( $x = 0, $y = 0, $w = 0, $h = 0, $page = -1, $name = '' )
Add an empty digital signature appearance (a cliccable rectangle area to get signature properties)
Add an empty digital signature appearance (a cliccable rectangle area to get signature properties)
Parameters
- $x
- Abscissa of the upper-left corner.
- $y
- Ordinate of the upper-left corner.
- $w
- Width of the signature area.
- $h
- Height of the signature area.
- $page
- option page number (if < 0 the current page is used).
- $name
- Name of the signature.
Author
Nicola Asuni
Since
5.9.101 (2011-07-06)
Public
|
protected
(array)
|
#
getSignatureAppearanceArray( $x = 0, $y = 0, $w = 0, $h = 0, $page = -1, $name = '' )
Get the array that defines the signature appearance (page and rectangle coordinates).
Get the array that defines the signature appearance (page and rectangle coordinates).
Parameters
- $x
- Abscissa of the upper-left corner.
- $y
- Ordinate of the upper-left corner.
- $w
- Width of the signature area.
- $h
- Height of the signature area.
- $page
- option page number (if < 0 the current page is used).
- $name
- Name of the signature.
Returns
(array) Array defining page and rectangle coordinates of signature appearance.
Author
Nicola Asuni
Since
5.9.101 (2011-07-06)
Protected
|
public
|
#
setTimeStamp( $tsa_host = '', $tsa_username = '', $tsa_password = '', $tsa_cert = '' )
Enable document timestamping (requires the OpenSSL Library).
The trusted timestamping improve document security that means that no one should be able to change the document once it has been recorded.
Use with digital signature only!
Enable document timestamping (requires the OpenSSL Library).
The trusted timestamping improve document security that means that no one should be able to change the document once it has been recorded.
Use with digital signature only!
Parameters
- $tsa_host
- Time Stamping Authority (TSA) server (prefixed with 'https://')
- $tsa_username
- Specifies the username for TSA authorization (optional) OR specifies the TSA authorization PEM file (see: example_66.php, optional)
- $tsa_password
- Specifies the password for TSA authorization (optional)
- $tsa_cert
- Specifies the location of TSA certificate for authorization (optional for cURL)
Author
Richard Stockinger
Since
6.0.090 (2014-06-16)
Public
|
protected
(string)
|
#
applyTSA( $signature )
NOT YET IMPLEMENTED
Request TSA for a timestamp
NOT YET IMPLEMENTED
Request TSA for a timestamp
Parameters
- $signature
- Digital signature as binary string
Returns
(string) Timestamped digital signature
Author
Richard Stockinger
Since
6.0.090 (2014-06-16)
Protected
|
public
|
#
startPageGroup( $page = '' )
Create a new page group.
NOTE: call this function before calling AddPage()
Create a new page group.
NOTE: call this function before calling AddPage()
Parameters
- $page
- starting group page (leave empty for next page).
Since
3.0.000 (2008-03-27)
Public
|
public
|
#
setStartingPageNumber( $num = 1 )
Set the starting page number.
Set the starting page number.
Parameters
- $num
- Starting page number.
Since
5.9.093 (2011-06-16)
Public
|
public
string
|
#
getAliasRightShift( )
Returns the string alias used right align page numbers.
If the current font is unicode type, the returned string wil contain an additional open curly brace.
Returns the string alias used right align page numbers.
If the current font is unicode type, the returned string wil contain an additional open curly brace.
Returns
string
Since
5.9.099 (2011-06-27)
Public
|
public
string
|
#
getAliasNbPages( )
Returns the string alias used for the total number of pages.
If the current font is unicode type, the returned string is surrounded by additional curly braces.
This alias will be replaced by the total number of pages in the document.
Returns the string alias used for the total number of pages.
If the current font is unicode type, the returned string is surrounded by additional curly braces.
This alias will be replaced by the total number of pages in the document.
Returns
string
Since
4.0.018 (2008-08-08)
Public
|
public
string
|
#
getAliasNumPage( )
Returns the string alias used for the page number.
If the current font is unicode type, the returned string is surrounded by additional curly braces.
This alias will be replaced by the page number.
Returns the string alias used for the page number.
If the current font is unicode type, the returned string is surrounded by additional curly braces.
This alias will be replaced by the page number.
Returns
string
Since
4.5.000 (2009-01-02)
Public
|
public
alias
|
#
getPageGroupAlias( )
Return the alias for the total number of pages in the current page group.
If the current font is unicode type, the returned string is surrounded by additional curly braces.
This alias will be replaced by the total number of pages in this group.
Return the alias for the total number of pages in the current page group.
If the current font is unicode type, the returned string is surrounded by additional curly braces.
This alias will be replaced by the total number of pages in this group.
Returns
alias of the current page group
Since
3.0.000 (2008-03-27)
Public
|
public
alias
|
#
getPageNumGroupAlias( )
Return the alias for the page number on the current page group.
If the current font is unicode type, the returned string is surrounded by additional curly braces.
This alias will be replaced by the page number (relative to the belonging group).
Return the alias for the page number on the current page group.
If the current font is unicode type, the returned string is surrounded by additional curly braces.
This alias will be replaced by the page number (relative to the belonging group).
Returns
alias of the current page group
Since
4.5.000 (2009-01-02)
Public
|
public
current
|
#
getGroupPageNo( )
Return the current page in the group.
Return the current page in the group.
Returns
current page in the group
Since
3.0.000 (2008-03-27)
Public
|
public
|
#
getGroupPageNoFormatted( )
Returns the current group page number formatted as a string.
Returns the current group page number formatted as a string.
Since
4.3.003 (2008-11-18)
See
PaneNo(), formatPageNumber()
Public
|
public
|
#
PageNoFormatted( )
Returns the current page number formatted as a string.
Returns the current page number formatted as a string.
Since
4.2.005 (2008-11-06)
See
PaneNo(), formatPageNumber()
Public
|
protected
|
#
_putocg( )
Put pdf layers.
Since
3.0.000 (2008-03-27)
Protected
|
public
|
#
startLayer( $name = '', $print = true, $view = true, $lock = true )
Start a new pdf layer.
Parameters
- $name
- Layer name (only a-z letters and numbers). Leave empty for automatic name.
- $print
- Set to TRUE to print this layer, FALSE to not print and NULL to not set this option
- $view
- Set to true to view this layer.
- $lock
- If true lock the layer
Since
5.9.102 (2011-07-13)
Public
|
public
|
#
endLayer( )
End the current PDF layer.
End the current PDF layer.
Since
5.9.102 (2011-07-13)
Public
|
public
|
#
setVisibility( $v )
Set the visibility of the successive elements.
This can be useful, for instance, to put a background
image or color that will show on screen but won't print.
Set the visibility of the successive elements.
This can be useful, for instance, to put a background
image or color that will show on screen but won't print.
Parameters
- $v
- visibility mode. Legal values are: all, print, screen or view.
Since
3.0.000 (2008-03-27)
Public
|
protected
the
|
#
addExtGState( $parms )
Add transparency parameters to the current extgstate
Add transparency parameters to the current extgstate
Parameters
Returns
the number of extgstates
Since
3.0.000 (2008-03-27)
Protected
|
protected
|
#
setExtGState( $gs )
Add an extgstate
Parameters
Since
3.0.000 (2008-03-27)
Protected
|
protected
|
#
_putextgstates( )
Put extgstates for object transparency
Put extgstates for object transparency
Since
3.0.000 (2008-03-27)
Protected
|
public
|
#
setOverprint( $stroking = true, $nonstroking = '', $mode = 0 )
Set overprint mode for stroking (OP) and non-stroking (op) painting operations.
(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
Set overprint mode for stroking (OP) and non-stroking (op) painting operations.
(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
Parameters
- $stroking
- If true apply overprint for stroking operations.
- $nonstroking
- If true apply overprint for painting operations other than stroking.
- $mode
- Overprint mode: (0 = each source colour component value replaces the value previously painted for the corresponding device colorant; 1 = a tint value of 0.0 for a source colour component shall leave the corresponding component of the previously painted colour unchanged).
Since
5.9.152 (2012-03-23)
Public
|
public
array.
|
#
getOverprint( )
Get the overprint mode array (OP, op, OPM).
(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
Get the overprint mode array (OP, op, OPM).
(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
Returns
array.
Since
5.9.152 (2012-03-23)
Public
|
public
|
#
setAlpha( $stroking = 1, $bm = 'Normal', $nonstroking = '', $ais = false )
Set alpha for stroking (CA) and non-stroking (ca) operations.
Set alpha for stroking (CA) and non-stroking (ca) operations.
Parameters
- $stroking
- Alpha value for stroking operations: real value from 0 (transparent) to 1 (opaque).
- $bm
- blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity
- $nonstroking
- Alpha value for non-stroking operations: real value from 0 (transparent) to 1 (opaque).
- $ais
- (boolean)
Since
3.0.000 (2008-03-27)
Public
|
public
array.
|
#
getAlpha( )
Get the alpha mode array (CA, ca, BM, AIS).
(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
Get the alpha mode array (CA, ca, BM, AIS).
(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
Returns
array.
Since
5.9.152 (2012-03-23)
Public
|
public
|
#
setJPEGQuality( $quality )
Set the default JPEG compression quality (1-100)
Set the default JPEG compression quality (1-100)
Parameters
- $quality
- JPEG quality, integer between 1 and 100
Since
3.0.000 (2008-03-27)
Public
|
public
|
#
setDefaultTableColumns( $cols = 4 )
Set the default number of columns in a row for HTML tables.
Set the default number of columns in a row for HTML tables.
Parameters
Since
3.0.014 (2008-06-04)
Public
|
public
|
#
setCellHeightRatio( $h )
Set the height of the cell (line height) respect the font height.
Set the height of the cell (line height) respect the font height.
Parameters
- $h
- cell proportion respect font height (typical value = 1.25).
Since
3.0.014 (2008-06-04)
Public
|
public
|
#
getCellHeightRatio( )
return the height of cell repect font height.
return the height of cell repect font height.
Since
4.0.012 (2008-07-24)
Public
|
public
|
#
setPDFVersion( $version = '1.7' )
Set the PDF version (check PDF reference for valid values).
Set the PDF version (check PDF reference for valid values).
Parameters
- $version
- PDF document version.
Since
3.1.000 (2008-06-09)
Public
|
public
|
#
setViewerPreferences( $preferences )
Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.
(see Section 8.1 of PDF reference, "Viewer Preferences").
- HideToolbar boolean (Optional) A flag specifying whether to hide the viewer application's tool bars when the document is active. Default value: false.
- HideMenubar boolean (Optional) A flag specifying whether to hide the viewer application's menu bar when the document is active. Default value: false.
- HideWindowUI boolean (Optional) A flag specifying whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed. Default value: false.
- FitWindow boolean (Optional) A flag specifying whether to resize the document's window to fit the size of the first displayed page. Default value: false.
- CenterWindow boolean (Optional) A flag specifying whether to position the document's window in the center of the screen. Default value: false.
- DisplayDocTitle boolean (Optional; PDF 1.4) A flag specifying whether the window's title bar should display the document title taken from the Title entry of the document information dictionary (see Section 10.2.1, "Document Information Dictionary"). If false, the title bar should instead display the name of the PDF file containing the document. Default value: false.
- NonFullScreenPageMode name (Optional) The document's page mode, specifying how to display the document on exiting full-screen mode:
- UseNone Neither document outline nor thumbnail images visible
- UseOutlines Document outline visible
- UseThumbs Thumbnail images visible
- UseOC Optional content group panel visible
This entry is meaningful only if the value of the PageMode entry in the catalog dictionary (see Section 3.6.1, "Document Catalog") is FullScreen; it is ignored otherwise. Default value: UseNone. - ViewArea name (Optional; PDF 1.4) The name of the page boundary representing the area of a page to be displayed when viewing the document on the screen. Valid values are (see Section 10.10.1, "Page Boundaries").:
- MediaBox
- CropBox (default)
- BleedBox
- TrimBox
- ArtBox
- ViewClip name (Optional; PDF 1.4) The name of the page boundary to which the contents of a page are to be clipped when viewing the document on the screen. Valid values are (see Section 10.10.1, "Page Boundaries").:
- MediaBox
- CropBox (default)
- BleedBox
- TrimBox
- ArtBox
- PrintArea name (Optional; PDF 1.4) The name of the page boundary representing the area of a page to be rendered when printing the document. Valid values are (see Section 10.10.1, "Page Boundaries").:
- MediaBox
- CropBox (default)
- BleedBox
- TrimBox
- ArtBox
- PrintClip name (Optional; PDF 1.4) The name of the page boundary to which the contents of a page are to be clipped when printing the document. Valid values are (see Section 10.10.1, "Page Boundaries").:
- MediaBox
- CropBox (default)
- BleedBox
- TrimBox
- ArtBox
- PrintScaling name (Optional; PDF 1.6) The page scaling option to be selected when a print dialog is displayed for this document. Valid values are:
- None, which indicates that the print dialog should reflect no page scaling
- AppDefault (default), which indicates that applications should use the current print scaling
- Duplex name (Optional; PDF 1.7) The paper handling option to use when printing the file from the print dialog. The following values are valid:
- Simplex - Print single-sided
- DuplexFlipShortEdge - Duplex and flip on the short edge of the sheet
- DuplexFlipLongEdge - Duplex and flip on the long edge of the sheet
Default value: none - PickTrayByPDFSize boolean (Optional; PDF 1.7) A flag specifying whether the PDF page size is used to select the input paper tray. This setting influences only the preset values used to populate the print dialog presented by a PDF viewer application. If PickTrayByPDFSize is true, the check box in the print dialog associated with input paper tray is checked. Note: This setting has no effect on Mac OS systems, which do not provide the ability to pick the input tray by size.
- PrintPageRange array (Optional; PDF 1.7) The page numbers used to initialize the print dialog box when the file is printed. The first page of the PDF file is denoted by 1. Each pair consists of the first and last pages in the sub-range. An odd number of integers causes this entry to be ignored. Negative numbers cause the entire array to be ignored. Default value: as defined by PDF viewer application
- NumCopies integer (Optional; PDF 1.7) The number of copies to be printed when the print dialog is opened for this file. Supported values are the integers 2 through 5. Values outside this range are ignored. Default value: as defined by PDF viewer application, but typically 1
Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.
(see Section 8.1 of PDF reference, "Viewer Preferences").
- HideToolbar boolean (Optional) A flag specifying whether to hide the viewer application's tool bars when the document is active. Default value: false.
- HideMenubar boolean (Optional) A flag specifying whether to hide the viewer application's menu bar when the document is active. Default value: false.
- HideWindowUI boolean (Optional) A flag specifying whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed. Default value: false.
- FitWindow boolean (Optional) A flag specifying whether to resize the document's window to fit the size of the first displayed page. Default value: false.
- CenterWindow boolean (Optional) A flag specifying whether to position the document's window in the center of the screen. Default value: false.
- DisplayDocTitle boolean (Optional; PDF 1.4) A flag specifying whether the window's title bar should display the document title taken from the Title entry of the document information dictionary (see Section 10.2.1, "Document Information Dictionary"). If false, the title bar should instead display the name of the PDF file containing the document. Default value: false.
- NonFullScreenPageMode name (Optional) The document's page mode, specifying how to display the document on exiting full-screen mode:
- UseNone Neither document outline nor thumbnail images visible
- UseOutlines Document outline visible
- UseThumbs Thumbnail images visible
- UseOC Optional content group panel visible
This entry is meaningful only if the value of the PageMode entry in the catalog dictionary (see Section 3.6.1, "Document Catalog") is FullScreen; it is ignored otherwise. Default value: UseNone. - ViewArea name (Optional; PDF 1.4) The name of the page boundary representing the area of a page to be displayed when viewing the document on the screen. Valid values are (see Section 10.10.1, "Page Boundaries").:
- MediaBox
- CropBox (default)
- BleedBox
- TrimBox
- ArtBox
- ViewClip name (Optional; PDF 1.4) The name of the page boundary to which the contents of a page are to be clipped when viewing the document on the screen. Valid values are (see Section 10.10.1, "Page Boundaries").:
- MediaBox
- CropBox (default)
- BleedBox
- TrimBox
- ArtBox
- PrintArea name (Optional; PDF 1.4) The name of the page boundary representing the area of a page to be rendered when printing the document. Valid values are (see Section 10.10.1, "Page Boundaries").:
- MediaBox
- CropBox (default)
- BleedBox
- TrimBox
- ArtBox
- PrintClip name (Optional; PDF 1.4) The name of the page boundary to which the contents of a page are to be clipped when printing the document. Valid values are (see Section 10.10.1, "Page Boundaries").:
- MediaBox
- CropBox (default)
- BleedBox
- TrimBox
- ArtBox
- PrintScaling name (Optional; PDF 1.6) The page scaling option to be selected when a print dialog is displayed for this document. Valid values are:
- None, which indicates that the print dialog should reflect no page scaling
- AppDefault (default), which indicates that applications should use the current print scaling
- Duplex name (Optional; PDF 1.7) The paper handling option to use when printing the file from the print dialog. The following values are valid:
- Simplex - Print single-sided
- DuplexFlipShortEdge - Duplex and flip on the short edge of the sheet
- DuplexFlipLongEdge - Duplex and flip on the long edge of the sheet
Default value: none - PickTrayByPDFSize boolean (Optional; PDF 1.7) A flag specifying whether the PDF page size is used to select the input paper tray. This setting influences only the preset values used to populate the print dialog presented by a PDF viewer application. If PickTrayByPDFSize is true, the check box in the print dialog associated with input paper tray is checked. Note: This setting has no effect on Mac OS systems, which do not provide the ability to pick the input tray by size.
- PrintPageRange array (Optional; PDF 1.7) The page numbers used to initialize the print dialog box when the file is printed. The first page of the PDF file is denoted by 1. Each pair consists of the first and last pages in the sub-range. An odd number of integers causes this entry to be ignored. Negative numbers cause the entire array to be ignored. Default value: as defined by PDF viewer application
- NumCopies integer (Optional; PDF 1.7) The number of copies to be printed when the print dialog is opened for this file. Supported values are the integers 2 through 5. Values outside this range are ignored. Default value: as defined by PDF viewer application, but typically 1
Parameters
- $preferences
- array of options.
Author
Nicola Asuni
Since
3.1.000 (2008-06-09)
Public
|
public
|
#
colorRegistrationBar( $x, $y, $w, $h, $transition = true, $vertical = false, $colors = 'A,R,G,B,C,M,Y,K' )
Paints color transition registration bars
Paints color transition registration bars
Parameters
- $x
- abscissa of the top left corner of the rectangle.
- $y
- ordinate of the top left corner of the rectangle.
- $w
- width of the rectangle.
- $h
- height of the rectangle.
- $transition
- if true prints tcolor transitions to white.
- $vertical
- if true prints bar vertically.
- $colors
- colors to print separated by comma. Valid values are: A,W,R,G,B,C,M,Y,K,RGB,CMYK,ALL,ALLSPOT,. Where: A = grayscale black, W = grayscale white, R = RGB red, G RGB green, B RGB blue, C = CMYK cyan, M = CMYK magenta, Y = CMYK yellow, K = CMYK key/black, RGB = RGB registration color, CMYK = CMYK registration color, ALL = Spot registration color, ALLSPOT = print all defined spot colors, = name of the spot color to print.
Author
Nicola Asuni
Since
4.9.000 (2010-03-26)
Public
|
public
|
#
cropMark( $x, $y, $w, $h, $type = 'T,R,B,L', $color = array(100,100,100,100,'All') )
Paints crop marks.
Parameters
- $x
- abscissa of the crop mark center.
- $y
- ordinate of the crop mark center.
- $w
- width of the crop mark.
- $h
- height of the crop mark.
- $type
- type of crop mark, one symbol per type separated by comma: T = TOP, F = BOTTOM, L = LEFT, R = RIGHT, TL = A = TOP-LEFT, TR = B = TOP-RIGHT, BL = C = BOTTOM-LEFT, BR = D = BOTTOM-RIGHT.
- $color
- crop mark color (default spot registration color).
Author
Nicola Asuni
Since
4.9.000 (2010-03-26)
Public
|
public
|
#
registrationMark( $x, $y, $r, $double = false, $cola = array(100,100,100,100,'All'), $colb = array(0,0,0,0,'None') )
Paints a registration mark
Paints a registration mark
Parameters
- $x
- abscissa of the registration mark center.
- $y
- ordinate of the registration mark center.
- $r
- radius of the crop mark.
- $double
- if true print two concentric crop marks.
- $cola
- crop mark color (default spot registration color 'All').
- $colb
- second crop mark color (default spot registration color 'None').
Author
Nicola Asuni
Since
4.9.000 (2010-03-26)
Public
|
public
|
#
registrationMarkCMYK( $x, $y, $r )
Paints a CMYK registration mark
Paints a CMYK registration mark
Parameters
- $x
- abscissa of the registration mark center.
- $y
- ordinate of the registration mark center.
- $r
- radius of the crop mark.
Author
Nicola Asuni
Since
6.0.038 (2013-09-30)
Public
|
public
|
#
LinearGradient( $x, $y, $w, $h, $col1 = array(), $col2 = array(), $coords = array(0,0,1,0) )
Paints a linear colour gradient.
Paints a linear colour gradient.
Parameters
- $x
- abscissa of the top left corner of the rectangle.
- $y
- ordinate of the top left corner of the rectangle.
- $w
- width of the rectangle.
- $h
- height of the rectangle.
- $col1
- first color (Grayscale, RGB or CMYK components).
- $col2
- second color (Grayscale, RGB or CMYK components).
- $coords
- array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg). The default value is from left to right (x1=0, y1=0, x2=1, y2=0).
Author
Andreas W\FCrmser, Nicola Asuni
Since
3.1.000 (2008-06-09)
Public
|
public
|
#
RadialGradient( $x, $y, $w, $h, $col1 = array(), $col2 = array(), $coords = array(0.5,0.5,0.5,0.5,1) )
Paints a radial colour gradient.
Paints a radial colour gradient.
Parameters
- $x
- abscissa of the top left corner of the rectangle.
- $y
- ordinate of the top left corner of the rectangle.
- $w
- width of the rectangle.
- $h
- height of the rectangle.
- $col1
- first color (Grayscale, RGB or CMYK components).
- $col2
- second color (Grayscale, RGB or CMYK components).
- $coords
- array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1, (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg). (fx, fy) should be inside the circle, otherwise some areas will not be defined.
Author
Andreas W\FCrmser, Nicola Asuni
Since
3.1.000 (2008-06-09)
Public
|
public
|
#
CoonsPatchMesh( $x, $y, $w, $h, $col1 = array(), $col2 = array(), $col3 = array(), $col4 = array(), $coords = array(0.00,0.0,0.33,0.00,0.67,0.00,1.00,0.00,1.00,0.33,1.00,0.67,1.00,1.00,0.67,1.00,0.33,1.00,0.00,1.00,0.00,0.67,0.00,0.33), $coords_min = 0, $coords_max = 1, $antialias = false )
Paints a coons patch mesh.
Paints a coons patch mesh.
Parameters
- $x
- abscissa of the top left corner of the rectangle.
- $y
- ordinate of the top left corner of the rectangle.
- $w
- width of the rectangle.
- $h
- height of the rectangle.
- $col1
- first color (lower left corner) (RGB components).
- $col2
- second color (lower right corner) (RGB components).
- $col3
- third color (upper right corner) (RGB components).
- $col4
- fourth color (upper left corner) (RGB components).
- $coords
- for one patch mesh: array(float x1, float y1, .... float x12, float y12): 12 pairs of coordinates (normally from 0 to 1) which specify the Bezier control points that define the patch. First pair is the lower left edge point, next is its right control point (control point 2). Then the other points are defined in the order: control point 1, edge point, control point 2 going counter-clockwise around the patch. Last (x12, y12) is the first edge point's left control point (control point 1).
- for two or more patch meshes: array[number of patches]: arrays with the following keys for each patch: f: where to put that patch (0 = first patch, 1, 2, 3 = right, top and left of precedent patch - I didn't figure this out completely - just try and error ;-) points: 12 pairs of coordinates of the Bezier control points as above for the first patch, 8 pairs of coordinates for the following patches, ignoring the coordinates already defined by the precedent patch (I also didn't figure out the order of these - also: try and see what's happening) colors: must be 4 colors for the first patch, 2 colors for the following patches
- $coords_min
- minimum value used by the coordinates. If a coordinate's value is smaller than this it will be cut to coords_min. default: 0
- $coords_max
- maximum value used by the coordinates. If a coordinate's value is greater than this it will be cut to coords_max. default: 1
- $antialias
- A flag indicating whether to filter the shading function to prevent aliasing artifacts.
Author
Andreas W\FCrmser, Nicola Asuni
Since
3.1.000 (2008-06-09)
Public
|
protected
|
#
Clip( $x, $y, $w, $h )
Set a rectangular clipping area.
Set a rectangular clipping area.
Parameters
- $x
- abscissa of the top left corner of the rectangle (or top right corner for RTL mode).
- $y
- ordinate of the top left corner of the rectangle.
- $w
- width of the rectangle.
- $h
- height of the rectangle.
Author
Andreas W\FCrmser, Nicola Asuni
Since
3.1.000 (2008-06-09)
Protected
|
public
|
#
Gradient( $type, $coords, $stops, $background = array(), $antialias = false )
Output gradient.
Parameters
- $type
- type of gradient (1 Function-based shading; 2 Axial shading; 3 Radial shading; 4 Free-form Gouraud-shaded triangle mesh; 5 Lattice-form Gouraud-shaded triangle mesh; 6 Coons patch mesh; 7 Tensor-product patch mesh). (Not all types are currently supported)
- $coords
- array of coordinates.
- $stops
- array gradient color components: color = array of GRAY, RGB or CMYK color components; offset = (0 to 1) represents a location along the gradient vector; exponent = exponent of the exponential interpolation function (default = 1).
- $background
- An array of colour components appropriate to the colour space, specifying a single background colour value.
- $antialias
- A flag indicating whether to filter the shading function to prevent aliasing artifacts.
Author
Nicola Asuni
Since
3.1.000 (2008-06-09)
Public
|
public
|
#
_putshaders( )
Output gradient shaders.
Author
Nicola Asuni
Since
3.1.000 (2008-06-09)
Protected
|
public
|
#
PieSector( $xc, $yc, $r, $a, $b, $style = 'FD', $cw = true, $o = 90 )
Draw the sector of a circle.
It can be used for instance to render pie charts.
Draw the sector of a circle.
It can be used for instance to render pie charts.
Parameters
- $xc
- abscissa of the center.
- $yc
- ordinate of the center.
- $r
- radius.
- $a
- start angle (in degrees).
- $b
- end angle (in degrees).
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $cw
- indicates whether to go clockwise (default: true).
- $o
- origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock). Default: 90.
Author
Maxime Delorme, Nicola Asuni
Since
3.1.000 (2008-06-09)
Public
|
public
|
#
PieSectorXY( $xc, $yc, $rx, $ry, $a, $b, $style = 'FD', $cw = false, $o = 0, $nc = 2 )
Draw the sector of an ellipse.
It can be used for instance to render pie charts.
Draw the sector of an ellipse.
It can be used for instance to render pie charts.
Parameters
- $xc
- abscissa of the center.
- $yc
- ordinate of the center.
- $rx
- the x-axis radius.
- $ry
- the y-axis radius.
- $a
- start angle (in degrees).
- $b
- end angle (in degrees).
- $style
- Style of rendering. See the getPathPaintOperator() function for more information.
- $cw
- indicates whether to go clockwise.
- $o
- origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock).
- $nc
- Number of curves used to draw a 90 degrees portion of arc.
Author
Maxime Delorme, Nicola Asuni
Since
3.1.000 (2008-06-09)
Public
|
public
|
#
ImageEps( $file, $x = '', $y = '', $w = 0, $h = 0, $link = '', $useBoundingBox = true, $align = '', $palign = '', $border = 0, $fitonpage = false, $fixoutvals = false )
Embed vector-based Adobe Illustrator (AI) or AI-compatible EPS files.
NOTE: EPS is not yet fully implemented, use the setRasterizeVectorImages() method to enable/disable rasterization of vector images using ImageMagick library.
Only vector drawing is supported, not text or bitmap.
Although the script was successfully tested with various AI format versions, best results are probably achieved with files that were exported in the AI3 format (tested with Illustrator CS2, Freehand MX and Photoshop CS2).
Embed vector-based Adobe Illustrator (AI) or AI-compatible EPS files.
NOTE: EPS is not yet fully implemented, use the setRasterizeVectorImages() method to enable/disable rasterization of vector images using ImageMagick library.
Only vector drawing is supported, not text or bitmap.
Although the script was successfully tested with various AI format versions, best results are probably achieved with files that were exported in the AI3 format (tested with Illustrator CS2, Freehand MX and Photoshop CS2).
Parameters
- $file
- Name of the file containing the image or a '@' character followed by the EPS/AI data string.
- $x
- Abscissa of the upper-left corner.
- $y
- Ordinate of the upper-left corner.
- $w
- Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
- $h
- Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
- $link
- URL or identifier returned by AddLink().
- $useBoundingBox
- specifies whether to position the bounding box (true) or the complete canvas (false) at location (x,y). Default value is true.
- $align
Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
- T: top-right for LTR or top-left for RTL
- M: middle-right for LTR or middle-left for RTL
- B: bottom-right for LTR or bottom-left for RTL
- N: next line
- $palign
Allows to center or align the image on the current line. Possible values are:
- L : left align
- C : center
- R : right align
- '' : empty string : left for LTR or right for RTL
- $border
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
- $fitonpage
- if true the image is resized to not exceed page dimensions.
- $fixoutvals
- if true remove values outside the bounding box.
Author
Valentin Schmidt, Nicola Asuni
Since
3.1.000 (2008-06-09)
Public
|
public
|
#
setBarcode( $bc = '' )
Set document barcode.
Parameters
Public
|
public
string
|
#
getBarcode( )
Get current barcode.
Returns
string
Since
4.0.012 (2008-07-24)
Public
|
public
|
#
write1DBarcode( $code, $type, $x = '', $y = '', $w = '', $h = '', $xres = '', $style = '', $align = '' )
Print a Linear Barcode.
Parameters
- $code
- code to print
- $type
- type of barcode (see tcpdf_barcodes_1d.php for supported formats).
- $x
- x position in user units (empty string = current x position)
- $y
- y position in user units (empty string = current y position)
- $w
- width in user units (empty string = remaining page width)
- $h
- height in user units (empty string = remaining page height)
- $xres
- width of the smallest bar in user units (empty string = default value = 0.4mm)
- $style
array of options:
- boolean $style['border'] if true prints a border
- int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)
- int $style['hpadding'] horizontal padding in user units (set to 'auto' for automatic padding)
- int $style['vpadding'] vertical padding in user units (set to 'auto' for automatic padding)
- array $style['fgcolor'] color array for bars and text
- mixed $style['bgcolor'] color array for background (set to false for transparent)
- boolean $style['text'] if true prints text below the barcode
- string $style['label'] override default label
- string $style['font'] font name for text
- int $style['fontsize'] font size for text
- int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing.
- string $style['position'] horizontal position of the containing barcode cell on the page: L = left margin; C = center; R = right margin.
- string $style['align'] horizontal position of the barcode on the containing rectangle: L = left; C = center; R = right.
- string $style['stretch'] if true stretch the barcode to best fit the available width, otherwise uses $xres resolution for a single bar.
- string $style['fitwidth'] if true reduce the width to fit the barcode width + padding. When this option is enabled the 'stretch' option is automatically disabled.
- string $style['cellfitalign'] this option works only when 'fitwidth' is true and 'position' is unset or empty. Set the horizontal position of the containing barcode cell inside the specified rectangle: L = left; C = center; R = right.
- $align
Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
- T: top-right for LTR or top-left for RTL
- M: middle-right for LTR or middle-left for RTL
- B: bottom-right for LTR or bottom-left for RTL
- N: next line
Author
Nicola Asuni
Since
3.1.000 (2008-06-09)
Public
|
public
|
#
write2DBarcode( $code, $type, $x = '', $y = '', $w = '', $h = '', $style = '', $align = '', $distort = false )
Print 2D Barcode.
Parameters
- $code
- code to print
- $type
- type of barcode (see tcpdf_barcodes_2d.php for supported formats).
- $x
- x position in user units
- $y
- y position in user units
- $w
- width in user units
- $h
- height in user units
- $style
array of options:
- boolean $style['border'] if true prints a border around the barcode
- int $style['padding'] padding to leave around the barcode in barcode units (set to 'auto' for automatic padding)
- int $style['hpadding'] horizontal padding in barcode units (set to 'auto' for automatic padding)
- int $style['vpadding'] vertical padding in barcode units (set to 'auto' for automatic padding)
- int $style['module_width'] width of a single module in points
- int $style['module_height'] height of a single module in points
- array $style['fgcolor'] color array for bars and text
- mixed $style['bgcolor'] color array for background or false for transparent
- string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch
- $style['module_width'] width of a single module in points
- $style['module_height'] height of a single module in points
- $align
Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
- T: top-right for LTR or top-left for RTL
- M: middle-right for LTR or middle-left for RTL
- B: bottom-right for LTR or bottom-left for RTL
- N: next line
- $distort
- if true distort the barcode to fit width and height, otherwise preserve aspect ratio
Author
Nicola Asuni
Since
4.5.037 (2009-04-07)
Public
|
public
array
|
#
getMargins( )
Returns an array containing current margins:
- $ret['left'] = left margin
- $ret['right'] = right margin
- $ret['top'] = top margin
- $ret['bottom'] = bottom margin
- $ret['header'] = header margin
- $ret['footer'] = footer margin
- $ret['cell'] = cell padding array
- $ret['padding_left'] = cell left padding
- $ret['padding_top'] = cell top padding
- $ret['padding_right'] = cell right padding
- $ret['padding_bottom'] = cell bottom padding
Returns an array containing current margins:
- $ret['left'] = left margin
- $ret['right'] = right margin
- $ret['top'] = top margin
- $ret['bottom'] = bottom margin
- $ret['header'] = header margin
- $ret['footer'] = footer margin
- $ret['cell'] = cell padding array
- $ret['padding_left'] = cell left padding
- $ret['padding_top'] = cell top padding
- $ret['padding_right'] = cell right padding
- $ret['padding_bottom'] = cell bottom padding
Returns
array containing all margins measures
Since
3.2.000 (2008-06-23)
Public
|
public
array
|
#
getOriginalMargins( )
Returns an array containing original margins:
- $ret['left'] = left margin
- $ret['right'] = right margin
Returns an array containing original margins:
- $ret['left'] = left margin
- $ret['right'] = right margin
Returns
array containing all margins measures
Since
4.0.012 (2008-07-24)
Public
|
public
current
|
#
getFontSize( )
Returns the current font size.
Returns the current font size.
Returns
current font size
Since
3.2.000 (2008-06-23)
Public
|
public
current
|
#
getFontSizePt( )
Returns the current font size in points unit.
Returns the current font size in points unit.
Returns
current font size in points unit
Since
3.2.000 (2008-06-23)
Public
|
public
string
|
#
getFontFamily( )
Returns the current font family name.
Returns the current font family name.
Returns
string current font family name
Since
4.3.008 (2008-12-05)
Public
|
public
string
|
#
getFontStyle( )
Returns the current font style.
Returns the current font style.
Returns
string current font style
Since
4.3.008 (2008-12-05)
Public
|
public
string
|
#
fixHTMLCode( $html, $default_css = '', $tagvs = '', $tidy_options = '' )
Cleanup HTML code (requires HTML Tidy library).
Cleanup HTML code (requires HTML Tidy library).
Parameters
- $html
- htmlcode to fix
- $default_css
- CSS commands to add
- $tagvs
- parameters for setHtmlVSpace method
- $tidy_options
- options for tidy_parse_string function
Returns
string XHTML code cleaned up
Author
Nicola Asuni
Since
5.9.017 (2010-11-16)
See
Public
|
protected
integer
|
#
getCSSBorderWidth( $width )
Returns the border width from CSS property
Returns the border width from CSS property
Parameters
Returns
integer with in user units
Since
5.7.000 (2010-08-02)
Protected
|
protected
integer
|
#
getCSSBorderDashStyle( $style )
Returns the border dash style from CSS property
Returns the border dash style from CSS property
Parameters
- $style
- border style to convert
Returns
integer sash style (return -1 in case of none or hidden border)
Since
5.7.000 (2010-08-02)
Protected
|
protected
array
|
#
getCSSBorderStyle( $cssborder )
Returns the border style array from CSS border properties
Returns the border style array from CSS border properties
Parameters
- $cssborder
- border properties
Returns
array containing border properties
Since
5.7.000 (2010-08-02)
Protected
|
public
array
|
#
getCSSPadding( $csspadding, $width = 0 )
Get the internal Cell padding from CSS attribute.
Get the internal Cell padding from CSS attribute.
Parameters
- $csspadding
- padding properties
- $width
- width of the containing element
Returns
array of cell paddings
Since
5.9.000 (2010-10-04)
Public
|
public
array
|
#
getCSSMargin( $cssmargin, $width = 0 )
Get the internal Cell margin from CSS attribute.
Get the internal Cell margin from CSS attribute.
Parameters
- $cssmargin
- margin properties
- $width
- width of the containing element
Returns
array of cell margins
Since
5.9.000 (2010-10-04)
Public
|
public
array
|
#
getCSSBorderMargin( $cssbspace, $width = 0 )
Get the border-spacing from CSS attribute.
Get the border-spacing from CSS attribute.
Parameters
- $cssbspace
- border-spacing CSS properties
- $width
- width of the containing element
Returns
array of border spacings
Since
5.9.010 (2010-10-27)
Public
|
protected
float
|
#
getCSSFontSpacing( $spacing, $parent = 0 )
Returns the letter-spacing value from CSS value
Returns the letter-spacing value from CSS value
Parameters
- $spacing
- letter-spacing value
- $parent
- font spacing (tracking) value of the parent element
Returns
float quantity to increases or decreases the space between characters in a text.
Since
5.9.000 (2010-10-02)
Protected
|
protected
float
|
#
getCSSFontStretching( $stretch, $parent = 100 )
Returns the percentage of font stretching from CSS value
Returns the percentage of font stretching from CSS value
Parameters
- $stretch
- stretch mode
- $parent
- stretch value of the parent element
Returns
float font stretching percentage
Since
5.9.000 (2010-10-02)
Protected
|
public
float
|
#
getHTMLFontUnits( $val, $refsize = 12, $parent_size = 12, $defaultunit = 'pt' )
Convert HTML string containing font size value to points
Convert HTML string containing font size value to points
Parameters
- $val
- String containing font size value and unit.
- $refsize
- Reference font size in points.
- $parent_size
- Parent font size in points.
- $defaultunit
- Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt).
Returns
float value in points
Public
|
protected
array
|
#
getHtmlDomArray( $html )
Returns the HTML DOM array.
Returns the HTML DOM array.
Parameters
Returns
array
Since
3.2.000 (2008-06-20)
Protected
|
protected
string
|
#
getSpaceString( )
Returns the string used to find spaces
Returns the string used to find spaces
Returns
string
Author
Nicola Asuni
Since
4.8.024 (2010-01-15)
Protected
|
protected
string
|
#
getHashForTCPDFtagParams( $data )
Return an hash code used to ensure that the serialized data has been generated by this TCPDF instance.
Return an hash code used to ensure that the serialized data has been generated by this TCPDF instance.
Parameters
Returns
string
Public
static
|
public
string
|
#
serializeTCPDFtagParameters( $data )
Serialize an array of parameters to be used with TCPDF tag in HTML code.
Serialize an array of parameters to be used with TCPDF tag in HTML code.
Parameters
Returns
string containing serialized data
Public
static
|
protected
array
|
#
unserializeTCPDFtagParameters( $data )
Unserialize parameters to be used with TCPDF tag in HTML code.
Unserialize parameters to be used with TCPDF tag in HTML code.
Parameters
Returns
array containing unserialized data
Protected
static
|
public
|
#
writeHTMLCell( $w, $h, $x, $y, $html = '', $border = 0, $ln = 0, $fill = false, $reseth = true, $align = '', $autopadding = true )
Prints a cell (rectangular area) with optional borders, background color and html text string.
The upper-left corner of the cell corresponds to the current position. After the call, the current position moves to the right or to the next line.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting.
Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul
NOTE: all the HTML attributes must be enclosed in double-quote.
Prints a cell (rectangular area) with optional borders, background color and html text string.
The upper-left corner of the cell corresponds to the current position. After the call, the current position moves to the right or to the next line.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting.
Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul
NOTE: all the HTML attributes must be enclosed in double-quote.
Parameters
- $w
- Cell width. If 0, the cell extends up to the right margin.
- $h
- Cell minimum height. The cell extends automatically if needed.
- $x
- upper-left corner X coordinate
- $y
- upper-left corner Y coordinate
- $html
- html text to print. Default value: empty string.
- $border
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
- $ln
Indicates where the current position should go after the call. Possible values are:
- 0: to the right (or left for RTL language)
- 1: to the beginning of the next line
- 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
- $fill
- Indicates if the cell background must be painted (true) or transparent (false).
- $reseth
- if true reset the last cell height (default true).
- $align
Allows to center or align the text. Possible values are:
- L : left align
- C : center
- R : right align
- '' : empty string : left for LTR or right for RTL
- $autopadding
- if true, uses internal padding and automatically adjust it to account for line width.
See
Public
|
public
|
#
writeHTML( $html, $ln = true, $fill = false, $reseth = false, $cell = false, $align = '' )
Allows to preserve some HTML formatting (limited support).
IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting.
Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul
NOTE: all the HTML attributes must be enclosed in double-quote.
Allows to preserve some HTML formatting (limited support).
IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting.
Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul
NOTE: all the HTML attributes must be enclosed in double-quote.
Parameters
- $html
- text to display
- $ln
- if true add a new line after text (default = true)
- $fill
- Indicates if the background must be painted (true) or transparent (false).
- $reseth
- if true reset the last cell height (default false).
- $cell
- if true add the current left (or right for RTL) padding to each Write (default false).
- $align
Allows to center or align the text. Possible values are:
- L : left align
- C : center
- R : right align
- '' : empty string : left for LTR or right for RTL
Public
|
protected
|
#
openHTMLTagHandler( $dom, $key, $cell )
Process opening tags.
Parameters
- $dom
- html dom array
- $key
- current element id
- $cell
- if true add the default left (or right if RTL) padding to each new line (default false).
Returns
$dom array
Protected
|
protected
|
#
closeHTMLTagHandler( $dom, $key, $cell, $maxbottomliney = 0 )
Process closing tags.
Parameters
- $dom
- html dom array
- $key
- current element id
- $cell
- if true add the default left (or right if RTL) padding to each new line (default false).
- $maxbottomliney
- maximum y value of current line
Returns
$dom array
Protected
|
protected
|
#
addHTMLVertSpace( $hbz = 0, $hb = 0, $cell = false, $firsttag = false, $lasttag = false )
Add vertical spaces if needed.
Add vertical spaces if needed.
Parameters
- $hbz
- Distance between current y and line bottom.
- $hb
- The height of the break.
- $cell
- if true add the default left (or right if RTL) padding to each new line (default false).
- $firsttag
- set to true when the tag is the first.
- $lasttag
- set to true when the tag is the last.
Protected
|
protected
array
|
#
getBorderStartPosition( )
Return the starting coordinates to draw an html border
Return the starting coordinates to draw an html border
Returns
array containing top-left border coordinates
Since
5.7.000 (2010-08-03)
Protected
|
protected
|
#
drawHTMLTagBorder( $tag, $xmax )
Draw an HTML block border and fill
Draw an HTML block border and fill
Parameters
- $tag
- array of tag properties.
- $xmax
- end X coordinate for border.
Since
5.7.000 (2010-08-03)
Protected
|
public
|
#
setLIsymbol( $symbol = '!' )
Set the default bullet to be used as LI bullet symbol
Set the default bullet to be used as LI bullet symbol
Parameters
- $symbol
- character or string to be used (legal values are: '' = automatic, '!' = auto bullet, '#' = auto numbering, 'disc', 'disc', 'circle', 'square', '1', 'decimal', 'decimal-leading-zero', 'i', 'lower-roman', 'I', 'upper-roman', 'a', 'lower-alpha', 'lower-latin', 'A', 'upper-alpha', 'upper-latin', 'lower-greek', 'img|type|width|height|image.ext')
Since
4.0.028 (2008-09-26)
Public
|
public
|
#
SetBooklet( $booklet = true, $inner = -1, $outer = -1 )
Set the booklet mode for double-sided pages.
Set the booklet mode for double-sided pages.
Parameters
- $booklet
- true set the booklet mode on, false otherwise.
- $inner
- Inner page margin.
- $outer
- Outer page margin.
Since
4.2.000 (2008-10-29)
Public
|
protected
|
#
swapMargins( $reverse = true )
Swap the left and right margins.
Swap the left and right margins.
Parameters
- $reverse
- if true swap left and right margins.
Since
4.2.000 (2008-10-29)
Protected
|
public
|
#
setHtmlVSpace( $tagvs )
Set the vertical spaces for HTML tags.
The array must have the following structure (example):
$tagvs = array('h1' => array(0 => array('h' => '', 'n' => 2), 1 => array('h' => 1.3, 'n' => 1)));
The first array level contains the tag names,
the second level contains 0 for opening tags or 1 for closing tags,
the third level contains the vertical space unit (h) and the number spaces to add (n).
If the h parameter is not specified, default values are used.
Set the vertical spaces for HTML tags.
The array must have the following structure (example):
$tagvs = array('h1' => array(0 => array('h' => '', 'n' => 2), 1 => array('h' => 1.3, 'n' => 1)));
The first array level contains the tag names,
the second level contains 0 for opening tags or 1 for closing tags,
the third level contains the vertical space unit (h) and the number spaces to add (n).
If the h parameter is not specified, default values are used.
Parameters
- $tagvs
- array of tags and relative vertical spaces.
Since
4.2.001 (2008-10-30)
Public
|
public
|
#
setListIndentWidth( $width )
Set custom width for list indentation.
Set custom width for list indentation.
Parameters
- $width
- width of the indentation. Use negative value to disable it.
Since
4.2.007 (2008-11-12)
Public
|
public
|
#
setOpenCell( $isopen )
Set the top/bottom cell sides to be open or closed when the cell cross the page.
Set the top/bottom cell sides to be open or closed when the cell cross the page.
Parameters
- $isopen
- if true keeps the top/bottom border open for the cell sides that cross the page.
Since
4.2.010 (2008-11-14)
Public
|
public
|
#
setHtmlLinksStyle( $color = array(0,0,255), $fontstyle = 'U' )
Set the color and font style for HTML links.
Set the color and font style for HTML links.
Parameters
- $color
- RGB array of colors
- $fontstyle
- additional font styles to add
Since
4.4.003 (2008-12-09)
Public
|
public
float
|
#
getHTMLUnitToUnits( $htmlval, $refsize = 1, $defaultunit = 'px', $points = false )
Convert HTML string containing value and unit of measure to user's units or points.
Convert HTML string containing value and unit of measure to user's units or points.
Parameters
- $htmlval
- String containing values and unit.
- $refsize
- Reference value in points.
- $defaultunit
- Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt).
- $points
- If true returns points, otherwise returns value in user's units.
Returns
float value in user's unit or point if $points=true
Since
4.4.004 (2008-12-10)
Public
|
protected
|
#
putHtmlListBullet( $listdepth, $listtype = '', $size = 10 )
Output an HTML list bullet or ordered item symbol
Output an HTML list bullet or ordered item symbol
Parameters
- $listdepth
- list nesting level
- $listtype
- type of list
- $size
- current font size
Since
4.4.004 (2008-12-10)
Protected
|
protected
array
|
#
getGraphicVars( )
Returns current graphic variables as array.
Returns current graphic variables as array.
Returns
array of graphic variables
Since
4.2.010 (2008-11-14)
Protected
|
protected
|
#
setGraphicVars( $gvars, $extended = false )
Set graphic variables.
Parameters
- $gvars
- array of graphic variablesto restore
- $extended
- if true restore extended graphic variables
Since
4.2.010 (2008-11-14)
Protected
|
protected
|
#
_outSaveGraphicsState( )
Outputs the "save graphics state" operator 'q'
Outputs the "save graphics state" operator 'q'
Protected
|
protected
|
#
_outRestoreGraphicsState( )
Outputs the "restore graphics state" operator 'Q'
Outputs the "restore graphics state" operator 'Q'
Protected
|
protected
|
#
setBuffer( $data )
Set buffer content (always append data).
Set buffer content (always append data).
Parameters
Since
4.5.000 (2009-01-02)
Protected
|
protected
|
#
replaceBuffer( $data )
Replace the buffer content
Replace the buffer content
Parameters
Since
5.5.000 (2010-06-22)
Protected
|
protected
string
|
#
getBuffer( )
Get buffer content.
Returns
string buffer content
Since
4.5.000 (2009-01-02)
Protected
|
protected
|
#
setPageBuffer( $page, $data, $append = false )
Set page buffer content.
Parameters
- $page
- page number
- $data
- page data
- $append
- if true append data, false replace.
Since
4.5.000 (2008-12-31)
Protected
|
protected
string
|
#
getPageBuffer( $page )
Get page buffer content.
Parameters
Returns
string page buffer content or false in case of error
Since
4.5.000 (2008-12-31)
Protected
|
protected
integer
|
#
setImageBuffer( $image, $data )
Set image buffer content.
Set image buffer content.
Parameters
- $image
- image key
- $data
- image data
Returns
integer image index number
Since
4.5.000 (2008-12-31)
Protected
|
protected
|
#
setImageSubBuffer( $image, $key, $data )
Set image buffer content for a specified sub-key.
Set image buffer content for a specified sub-key.
Parameters
- $image
- image key
- $key
- image sub-key
- $data
- image data
Since
4.5.000 (2008-12-31)
Protected
|
protected
string
|
#
getImageBuffer( $image )
Get image buffer content.
Get image buffer content.
Parameters
Returns
string image buffer content or false in case of error
Since
4.5.000 (2008-12-31)
Protected
|
protected
|
#
setFontBuffer( $font, $data )
Set font buffer content.
Parameters
- $font
- font key
- $data
- font data
Since
4.5.000 (2009-01-02)
Protected
|
protected
|
#
setFontSubBuffer( $font, $key, $data )
Set font buffer content.
Parameters
- $font
- font key
- $key
- font sub-key
- $data
- font data
Since
4.5.000 (2009-01-02)
Protected
|
protected
string
|
#
getFontBuffer( $font )
Get font buffer content.
Parameters
Returns
string font buffer content or false in case of error
Since
4.5.000 (2009-01-02)
Protected
|
public
true
|
#
movePage( $frompage, $topage )
Move a page to a previous position.
Move a page to a previous position.
Parameters
- $frompage
- number of the source page
- $topage
- number of the destination page (must be less than $frompage)
Returns
true in case of success, false in case of error.
Since
4.5.000 (2009-01-02)
Public
|
public
true
|
#
deletePage( $page )
Remove the specified page.
Remove the specified page.
Parameters
Returns
true in case of success, false in case of error.
Since
4.6.004 (2009-04-23)
Public
|
public
true
|
#
copyPage( $page = 0 )
Clone the specified page to a new page.
Clone the specified page to a new page.
Parameters
- $page
- number of page to copy (0 = current page)
Returns
true in case of success, false in case of error.
Since
4.9.015 (2010-04-20)
Public
|
public
|
#
addTOC( $page = '', $numbersfont = '', $filler = '.', $toc_name = 'TOC', $style = '', $color = array(0,0,0) )
Output a Table of Content Index (TOC).
This method must be called after all Bookmarks were set.
Before calling this method you have to open the page using the addTOCPage() method.
After calling this method you have to call endTOCPage() to close the TOC page.
You can override this method to achieve different styles.
Output a Table of Content Index (TOC).
This method must be called after all Bookmarks were set.
Before calling this method you have to open the page using the addTOCPage() method.
After calling this method you have to call endTOCPage() to close the TOC page.
You can override this method to achieve different styles.
Parameters
- $page
- page number where this TOC should be inserted (leave empty for current page).
- $numbersfont
- set the font for page numbers (please use monospaced font for better alignment).
- $filler
- string used to fill the space between text and page number.
- $toc_name
- name to use for TOC bookmark.
- $style
- Font style for title: B = Bold, I = Italic, BI = Bold + Italic.
- $color
- RGB color array for bookmark title (values from 0 to 255).
Author
Nicola Asuni
Since
4.5.000 (2009-01-02)
See
Public
|
public
|
#
addHTMLTOC( $page = '', $toc_name = 'TOC', $templates = array(), $correct_align = true, $style = '', $color = array(0,0,0) )
Output a Table Of Content Index (TOC) using HTML templates.
This method must be called after all Bookmarks were set.
Before calling this method you have to open the page using the addTOCPage() method.
After calling this method you have to call endTOCPage() to close the TOC page.
Output a Table Of Content Index (TOC) using HTML templates.
This method must be called after all Bookmarks were set.
Before calling this method you have to open the page using the addTOCPage() method.
After calling this method you have to call endTOCPage() to close the TOC page.
Parameters
- $page
- page number where this TOC should be inserted (leave empty for current page).
- $toc_name
- name to use for TOC bookmark.
- $templates
- array of html templates. Use: "#TOC_DESCRIPTION#" for bookmark title, "#TOC_PAGE_NUMBER#" for page number.
- $correct_align
- if true correct the number alignment (numbers must be in monospaced font like courier and right aligned on LTR, or left aligned on RTL)
- $style
- Font style for title: B = Bold, I = Italic, BI = Bold + Italic.
- $color
- RGB color array for title (values from 0 to 255).
Author
Nicola Asuni
Since
5.0.001 (2010-05-06)
See
Public
|
public
|
#
startTransaction( )
Stores a copy of the current TCPDF object used for undo operation.
Stores a copy of the current TCPDF object used for undo operation.
Since
4.5.029 (2009-03-19)
Public
|
public
|
#
commitTransaction( )
Delete the copy of the current TCPDF object used for undo operation.
Delete the copy of the current TCPDF object used for undo operation.
Since
4.5.029 (2009-03-19)
Public
|
public
TCPDF
|
#
rollbackTransaction( $self = false )
This method allows to undo the latest transaction by returning the latest saved TCPDF object with startTransaction().
This method allows to undo the latest transaction by returning the latest saved TCPDF object with startTransaction().
Parameters
- $self
- if true restores current class object to previous state without the need of reassignment via the returned value.
Returns
Since
4.5.029 (2009-03-19)
Public
|
public
|
#
setEqualColumns( $numcols = 0, $width = 0, $y = '' )
Set multiple columns of the same size
Set multiple columns of the same size
Parameters
- $numcols
- number of columns (set to zero to disable columns mode)
- $width
- column width
- $y
- column starting Y position (leave empty for current Y position)
Since
4.9.001 (2010-03-28)
Public
|
public
|
#
resetColumns( )
Remove columns and reset page margins.
Remove columns and reset page margins.
Since
5.9.072 (2011-04-26)
Public
|
public
|
#
setColumnsArray( $columns )
Set columns array.
Each column is represented by an array of arrays with the following keys: (w = width, s = space between columns, y = column top position).
Set columns array.
Each column is represented by an array of arrays with the following keys: (w = width, s = space between columns, y = column top position).
Parameters
Since
4.9.001 (2010-03-28)
Public
|
public
|
#
selectColumn( $col = '' )
Set position at a given column
Set position at a given column
Parameters
- $col
- column number (from 0 to getNumberOfColumns()-1); empty string = current column.
Since
4.9.001 (2010-03-28)
Public
|
public
integer
|
#
getColumn( )
Return the current column number
Return the current column number
Returns
integer current column number
Since
5.5.011 (2010-07-08)
Public
|
public
integer
|
#
getNumberOfColumns( )
Return the current number of columns.
Return the current number of columns.
Returns
integer number of columns
Since
5.8.018 (2010-08-25)
Public
|
public
|
#
setTextRenderingMode( $stroke = 0, $fill = true, $clip = false )
Set Text rendering mode.
Parameters
- $stroke
- outline size in user units (0 = disable).
- $fill
- if true fills the text (default).
- $clip
- if true activate clipping mode
Since
4.9.008 (2009-04-02)
Public
|
public
|
#
setTextShadow( $params = array('enabled'=>false, 'depth_w'=>0, 'depth_h'=>0, 'color'=>false, 'opacity'=>1, 'blend_mode'=>'Normal') )
Set parameters for drop shadow effect for text.
Set parameters for drop shadow effect for text.
Parameters
- $params
- Array of parameters: enabled (boolean) set to true to enable shadow; depth_w (float) shadow width in user units; depth_h (float) shadow height in user units; color (array) shadow color or false to use the stroke color; opacity (float) Alpha value: real value from 0 (transparent) to 1 (opaque); blend_mode (string) blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity.
Since
5.9.174 (2012-07-25)
Public
|
public
Array
|
#
getTextShadow( )
Return the text shadow parameters array.
Return the text shadow parameters array.
Returns
Array of parameters.
Since
5.9.174 (2012-07-25)
Public
|
protected
array
|
#
hyphenateWord( $word, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8 )
Returns an array of chars containing soft hyphens.
Returns an array of chars containing soft hyphens.
Parameters
- $word
- array of chars
- $patterns
- Array of hypenation patterns.
- $dictionary
- Array of words to be returned without applying the hyphenation algorithm.
- $leftmin
- Minimum number of character to leave on the left of the word without applying the hyphens.
- $rightmin
- Minimum number of character to leave on the right of the word without applying the hyphens.
- $charmin
- Minimum word length to apply the hyphenation algorithm.
- $charmax
- Maximum length of broken piece of word.
Returns
array text with soft hyphens
Author
Nicola Asuni
Since
4.9.012 (2010-04-12)
Protected
|
public
array
|
#
hyphenateText( $text, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8 )
Returns text with soft hyphens.
Returns text with soft hyphens.
Parameters
- $text
- text to process
- $patterns
- Array of hypenation patterns or a TEX file containing hypenation patterns. TEX patterns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/
- $dictionary
- Array of words to be returned without applying the hyphenation algorithm.
- $leftmin
- Minimum number of character to leave on the left of the word without applying the hyphens.
- $rightmin
- Minimum number of character to leave on the right of the word without applying the hyphens.
- $charmin
- Minimum word length to apply the hyphenation algorithm.
- $charmax
- Maximum length of broken piece of word.
Returns
array text with soft hyphens
Author
Nicola Asuni
Since
4.9.012 (2010-04-12)
Public
|
public
|
#
setRasterizeVectorImages( $mode )
Enable/disable rasterization of vector images using ImageMagick library.
Enable/disable rasterization of vector images using ImageMagick library.
Parameters
- $mode
- if true enable rasterization, false otherwise.
Since
5.0.000 (2010-04-27)
Public
|
public
|
#
setFontSubsetting( $enable = true )
Enable or disable default option for font subsetting.
Enable or disable default option for font subsetting.
Parameters
- $enable
- if true enable font subsetting by default.
Author
Nicola Asuni
Since
5.3.002 (2010-06-07)
Public
|
public
boolean
|
#
getFontSubsetting( )
Return the default option for font subsetting.
Return the default option for font subsetting.
Returns
boolean default font subsetting state.
Author
Nicola Asuni
Since
5.3.002 (2010-06-07)
Public
|
public
left
|
#
stringLeftTrim( $str, $replace = '' )
Left trim the input string
Left trim the input string
Parameters
- $str
- string to trim
- $replace
- string that replace spaces.
Returns
left trimmed string
Author
Nicola Asuni
Since
5.8.000 (2010-08-11)
Public
|
public
right
|
#
stringRightTrim( $str, $replace = '' )
Right trim the input string
Right trim the input string
Parameters
- $str
- string to trim
- $replace
- string that replace spaces.
Returns
right trimmed string
Author
Nicola Asuni
Since
5.8.000 (2010-08-11)
Public
|
public
trimmed
|
#
stringTrim( $str, $replace = '' )
Trim the input string
Parameters
- $str
- string to trim
- $replace
- string that replace spaces.
Returns
trimmed string
Author
Nicola Asuni
Since
5.8.000 (2010-08-11)
Public
|
public
true
|
#
isUnicodeFont( )
Return true if the current font is unicode type.
Return true if the current font is unicode type.
Returns
true for unicode font, false otherwise.
Author
Nicola Asuni
Since
5.8.002 (2010-08-14)
Public
|
public
string
|
#
getFontFamilyName( $fontfamily )
Return normalized font name
Return normalized font name
Parameters
- $fontfamily
- property string containing font family names
Returns
string normalized font name
Author
Nicola Asuni
Since
5.8.004 (2010-08-17)
Public
|
public
integer
|
#
startTemplate( $w = 0, $h = 0, $group = false )
Start a new XObject Template.
An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images).
An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked.
Note: X,Y coordinates will be reset to 0,0.
Start a new XObject Template.
An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images).
An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked.
Note: X,Y coordinates will be reset to 0,0.
Parameters
- $w
- Template width in user units (empty string or zero = page width less margins).
- $h
- Template height in user units (empty string or zero = page height less margins).
- $group
- Set transparency group. Can be a boolean value or an array specifying optional parameters: 'CS' (solour space name), 'I' (boolean flag to indicate isolated group) and 'K' (boolean flag to indicate knockout group).
Returns
integer the XObject Template ID in case of success or false in case of error.
Author
Nicola Asuni
Since
5.8.017 (2010-08-24)
See
Public
|
public
integer
|
#
endTemplate( )
End the current XObject Template started with startTemplate() and restore the previous graphic state.
An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images).
An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked.
End the current XObject Template started with startTemplate() and restore the previous graphic state.
An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images).
An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked.
Returns
integer the XObject Template ID in case of success or false in case of error.
Author
Nicola Asuni
Since
5.8.017 (2010-08-24)
See
Public
|
public
|
#
printTemplate( $id, $x = '', $y = '', $w = 0, $h = 0, $align = '', $palign = '', $fitonpage = false )
Print an XObject Template.
You can print an XObject Template inside the currently opened Template.
An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images).
An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked.
Print an XObject Template.
You can print an XObject Template inside the currently opened Template.
An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images).
An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked.
Parameters
- $id
- The ID of XObject Template to print.
- $x
- X position in user units (empty string = current x position)
- $y
- Y position in user units (empty string = current y position)
- $w
- Width in user units (zero = remaining page width)
- $h
- Height in user units (zero = remaining page height)
- $align
Indicates the alignment of the pointer next to template insertion relative to template height. The value can be:
- T: top-right for LTR or top-left for RTL
- M: middle-right for LTR or middle-left for RTL
- B: bottom-right for LTR or bottom-left for RTL
- N: next line
- $palign
Allows to center or align the template on the current line. Possible values are:
- L : left align
- C : center
- R : right align
- '' : empty string : left for LTR or right for RTL
- $fitonpage
- If true the template is resized to not exceed page dimensions.
Author
Nicola Asuni
Since
5.8.017 (2010-08-24)
See
Public
|
public
|
#
setFontStretching( $perc = 100 )
Set the percentage of character stretching.
Set the percentage of character stretching.
Parameters
- $perc
- percentage of stretching (100 = no stretching)
Author
Nicola Asuni
Since
5.9.000 (2010-09-29)
Public
|
public
float
|
#
getFontStretching( )
Get the percentage of character stretching.
Get the percentage of character stretching.
Returns
float stretching value
Author
Nicola Asuni
Since
5.9.000 (2010-09-29)
Public
|
public
|
#
setFontSpacing( $spacing = 0 )
Set the amount to increase or decrease the space between characters in a text.
Set the amount to increase or decrease the space between characters in a text.
Parameters
- $spacing
- amount to increase or decrease the space between characters in a text (0 = default spacing)
Author
Nicola Asuni
Since
5.9.000 (2010-09-29)
Public
|
public
integer
|
#
getFontSpacing( )
Get the amount to increase or decrease the space between characters in a text.
Get the amount to increase or decrease the space between characters in a text.
Returns
integer font spacing (tracking) value
Author
Nicola Asuni
Since
5.9.000 (2010-09-29)
Public
|
public
|
#
ImageSVG( $file, $x = '', $y = '', $w = 0, $h = 0, $link = '', $align = '', $palign = '', $border = 0, $fitonpage = false )
Embedd a Scalable Vector Graphics (SVG) image.
NOTE: SVG standard is not yet fully implemented, use the setRasterizeVectorImages() method to enable/disable rasterization of vector images using ImageMagick library.
Embedd a Scalable Vector Graphics (SVG) image.
NOTE: SVG standard is not yet fully implemented, use the setRasterizeVectorImages() method to enable/disable rasterization of vector images using ImageMagick library.
Parameters
- $file
- Name of the SVG file or a '@' character followed by the SVG data string.
- $x
- Abscissa of the upper-left corner.
- $y
- Ordinate of the upper-left corner.
- $w
- Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
- $h
- Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
- $link
- URL or identifier returned by AddLink().
- $align
Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
- T: top-right for LTR or top-left for RTL
- M: middle-right for LTR or middle-left for RTL
- B: bottom-right for LTR or bottom-left for RTL
- N: next line
If the alignment is an empty string, then the pointer will be restored on the starting SVG position.
- $palign
Allows to center or align the image on the current line. Possible values are:
- L : left align
- C : center
- R : right align
- '' : empty string : left for LTR or right for RTL
- $border
Indicates if borders must be drawn around the cell. The value can be a number:
- 0: no border (default)
- 1: frame
or a string containing some or all of the following characters (in any order):
- L: left
- T: top
- R: right
- B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
- $fitonpage
- if true the image is resized to not exceed page dimensions.
Author
Nicola Asuni
Since
5.0.000 (2010-05-02)
Public
|
protected
array
|
#
convertSVGtMatrix( $tm )
Convert SVG transformation matrix to PDF.
Convert SVG transformation matrix to PDF.
Parameters
- $tm
- original SVG transformation matrix
Returns
array transformation matrix
Since
5.0.000 (2010-05-02)
Protected
|
protected
|
#
SVGTransform( $tm )
Apply SVG graphic transformation matrix.
Apply SVG graphic transformation matrix.
Parameters
- $tm
- original SVG transformation matrix
Since
5.0.000 (2010-05-02)
Protected
|
protected
object
|
#
setSVGStyles( $svgstyle, $prevsvgstyle, $x = 0, $y = 0, $w = 1, $h = 1, $clip_function = '', $clip_params = array() )
Apply the requested SVG styles (*** TO BE COMPLETED ***)
Apply the requested SVG styles (*** TO BE COMPLETED ***)
Parameters
- $svgstyle
- array of SVG styles to apply
- $prevsvgstyle
- array of previous SVG style
- $x
- X origin of the bounding box
- $y
- Y origin of the bounding box
- $w
- width of the bounding box
- $h
- height of the bounding box
- $clip_function
- clip function
- $clip_params
- array of parameters for clipping function
Returns
object style
Author
Nicola Asuni
Since
5.0.000 (2010-05-02)
Protected
|
protected
array
|
#
SVGPath( $d, $style = '' )
Draws an SVG path
Parameters
- $d
- attribute d of the path SVG element
- $style
Style of rendering. Possible values are:
- D or empty string: Draw (default).
- F: Fill.
- F*: Fill using the even-odd rule to determine which regions lie inside the clipping path.
- DF or FD: Draw and fill.
- DF* or FD*: Draw and fill using the even-odd rule to determine which regions lie inside the clipping path.
- CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
- CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
Returns
array of container box measures (x, y, w, h)
Author
Nicola Asuni
Since
5.0.000 (2010-05-02)
Protected
|
protected
|
#
removeTagNamespace( $name )
Return the tag name without the namespace
Return the tag name without the namespace
Parameters
Protected
|
protected
|
#
startSVGElementHandler( $parser, $name, $attribs, $ctm = array() )
Sets the opening SVG element handler function for the XML parser. (*** TO BE COMPLETED ***)
Sets the opening SVG element handler function for the XML parser. (*** TO BE COMPLETED ***)
Parameters
- $parser
- The first parameter, parser, is a reference to the XML parser calling the handler.
- $name
- The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
- $attribs
- The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on.
- $ctm
- tranformation matrix for clipping mode (starting transformation matrix).
Author
Nicola Asuni
Since
5.0.000 (2010-05-02)
Protected
|
protected
|
#
endSVGElementHandler( $parser, $name )
Sets the closing SVG element handler function for the XML parser.
Sets the closing SVG element handler function for the XML parser.
Parameters
- $parser
- The first parameter, parser, is a reference to the XML parser calling the handler.
- $name
- The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
Author
Nicola Asuni
Since
5.0.000 (2010-05-02)
Protected
|
protected
|
#
segSVGContentHandler( $parser, $data )
Sets the character data handler function for the XML parser.
Sets the character data handler function for the XML parser.
Parameters
- $parser
- The first parameter, parser, is a reference to the XML parser calling the handler.
- $data
- The second parameter, data, contains the character data as a string.
Author
Nicola Asuni
Since
5.0.000 (2010-05-02)
Protected
|