$page
$page :
Current page number.
$textrendermode :
Text rendering mode: 0 = Fill text; 1 = Stroke text; 2 = Fill, then stroke text; 3 = Neither fill nor stroke text (invisible); 4 = Fill text and add to path for clipping; 5 = Stroke text and add to path for clipping; 6 = Fill, then stroke text and add to path for clipping; 7 = Add text to path for clipping.
__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).
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.
$orientation | (string) page orientation. Possible values are (case insensitive):
|
|
$unit | (string) User measure unit. Possible values are:
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 | (mixed) 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 | (boolean) TRUE means that the input text is unicode (default = true) |
|
$encoding | (string) Charset encoding (used only when converting back html entities); default is UTF-8. |
|
$diskcache | (boolean) DEPRECATED FEATURE |
|
$pdfa | (boolean) If TRUE set the document to PDF/A mode. |
setPageUnit( $unit)
Set the units of measure for the document.
$unit | (string) User measure unit. Possible values are:
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. |
setPageOrientation( $orientation, $autopagebreak = '', $bottommargin = '')
Set page orientation.
$orientation | (string) page orientation. Possible values are (case insensitive):
|
|
$autopagebreak | (boolean) Boolean indicating if auto-page-break mode should be on or off. |
|
$bottommargin | (float) bottom margin of the page. |
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)
$re | (string) regular expression (leave empty for default). |
getPageDimensions( $pagenum = '') : array
Returns an array of page dimensions: <ul><li>$this->pagedim[$this->page]['w'] = page width in points</li><li>$this->pagedim[$this->page]['h'] = height in points</li><li>$this->pagedim[$this->page]['wk'] = page width in user units</li><li>$this->pagedim[$this->page]['hk'] = page height in user units</li><li>$this->pagedim[$this->page]['tm'] = top margin</li><li>$this->pagedim[$this->page]['bm'] = bottom margin</li><li>$this->pagedim[$this->page]['lm'] = left margin</li><li>$this->pagedim[$this->page]['rm'] = right margin</li><li>$this->pagedim[$this->page]['pb'] = auto page break</li><li>$this->pagedim[$this->page]['or'] = page orientation</li><li>$this->pagedim[$this->page]['olm'] = original left margin</li><li>$this->pagedim[$this->page]['orm'] = original right margin</li><li>$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.</li><li>$this->pagedim[$this->page]['PZ'] = The page's preferred zoom (magnification) factor.</li><li>$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<ul><li>$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.</li><li>$this->pagedim[$this->page]['trans']['S'] = transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade</li><li>$this->pagedim[$this->page]['trans']['D'] = The duration of the transition effect, in seconds.</li><li>$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.</li><li>$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.</li><li>$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.</li><li>$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. </li><li>$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.</li></ul></li><li>$this->pagedim[$this->page]['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed<ul><li>$this->pagedim[$this->page]['MediaBox']['llx'] = lower-left x coordinate in points</li><li>$this->pagedim[$this->page]['MediaBox']['lly'] = lower-left y coordinate in points</li><li>$this->pagedim[$this->page]['MediaBox']['urx'] = upper-right x coordinate in points</li><li>$this->pagedim[$this->page]['MediaBox']['ury'] = upper-right y coordinate in points</li></ul></li><li>$this->pagedim[$this->page]['CropBox'] : the visible region of default user space<ul><li>$this->pagedim[$this->page]['CropBox']['llx'] = lower-left x coordinate in points</li><li>$this->pagedim[$this->page]['CropBox']['lly'] = lower-left y coordinate in points</li><li>$this->pagedim[$this->page]['CropBox']['urx'] = upper-right x coordinate in points</li><li>$this->pagedim[$this->page]['CropBox']['ury'] = upper-right y coordinate in points</li></ul></li><li>$this->pagedim[$this->page]['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment<ul><li>$this->pagedim[$this->page]['BleedBox']['llx'] = lower-left x coordinate in points</li><li>$this->pagedim[$this->page]['BleedBox']['lly'] = lower-left y coordinate in points</li><li>$this->pagedim[$this->page]['BleedBox']['urx'] = upper-right x coordinate in points</li><li>$this->pagedim[$this->page]['BleedBox']['ury'] = upper-right y coordinate in points</li></ul></li><li>$this->pagedim[$this->page]['TrimBox'] : the intended dimensions of the finished page after trimming<ul><li>$this->pagedim[$this->page]['TrimBox']['llx'] = lower-left x coordinate in points</li><li>$this->pagedim[$this->page]['TrimBox']['lly'] = lower-left y coordinate in points</li><li>$this->pagedim[$this->page]['TrimBox']['urx'] = upper-right x coordinate in points</li><li>$this->pagedim[$this->page]['TrimBox']['ury'] = upper-right y coordinate in points</li></ul></li><li>$this->pagedim[$this->page]['ArtBox'] : the extent of the page's meaningful content<ul><li>$this->pagedim[$this->page]['ArtBox']['llx'] = lower-left x coordinate in points</li><li>$this->pagedim[$this->page]['ArtBox']['lly'] = lower-left y coordinate in points</li><li>$this->pagedim[$this->page]['ArtBox']['urx'] = upper-right x coordinate in points</li><li>$this->pagedim[$this->page]['ArtBox']['ury'] = upper-right y coordinate in points</li></ul></li></ul>
$pagenum | (int) page number (empty = current page) |
of page dimensions.
SetMargins( $left, $top, $right = -1, $keepmargins = false)
Defines the left, top and right margins.
$left | (float) Left margin. |
|
$top | (float) Top margin. |
|
$right | (float) Right margin. Default value is the left one. |
|
$keepmargins | (boolean) if true overwrites the default page margins |
SetAutoPageBreak( $auto, $margin)
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.
$auto | (boolean) Boolean indicating if mode should be on or off. |
|
$margin | (float) Distance from the bottom of the page. |
SetDisplayMode( $zoom, $layout = 'SinglePage', $mode = 'UseNone')
Defines the way the document is to be displayed by the viewer.
$zoom | (mixed) The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.
|
|
$layout | (string) The page layout. Possible values are:
|
|
$mode | (string) A name object specifying how the document should be displayed when opened:
|
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.
$compress | (boolean) Boolean indicating if compression must be enabled. |
addTOCPage( $orientation = '', $format = '', $keepmargins = false)
Adds a new TOC (Table Of Content) page to the document.
$orientation | (string) page orientation. |
|
$format | (mixed) 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 | (boolean) if true overwrites the default page margins with the current margins |
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.
$orientation | (string) page orientation. Possible values are (case insensitive):
|
|
$format | (mixed) 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 | (boolean) if true overwrites the default page margins with the current margins |
|
$tocpage | (boolean) if true set the tocpage state to true (the added page will be used to display Table Of Content). |
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.
$orientation | (string) page orientation. Possible values are (case insensitive):
|
|
$format | (mixed) 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 | (boolean) if true the page is designated to contain the Table-Of-Content. |
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.
setHeaderData( $ln = '', $lw, $ht = '', $hs = '', $tc = array(0, 0, 0), $lc = array(0, 0, 0))
Set header data.
$ln | (string) header image logo |
|
$lw | (string) header image logo width in mm |
|
$ht | (string) string to print as title on document header |
|
$hs | (string) string to print on document header |
|
$tc | (array) RGB array color for text. |
|
$lc | (array) RGB array color for line. |
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.
$name | (string) Full name of the spot color. |
|
$c | (float) Cyan color for CMYK. Value between 0 and 100. |
|
$m | (float) Magenta color for CMYK. Value between 0 and 100. |
|
$y | (float) Yellow color for CMYK. Value between 0 and 100. |
|
$k | (float) Key (Black) color for CMYK. Value between 0 and 100. |
setSpotColor( $type, $name, $tint = 100) : \(string)
Set the spot color for the specified type ('draw', 'fill', 'text').
$type | (string) Type of object affected by this color: ('draw', 'fill', 'text'). |
|
$name | (string) Name of the spot color. |
|
$tint | (float) Intensity of the color (from 0 to 100 ; 100 = full intensity by default). |
PDF color command.
setColorArray( $type, $color, $ret = false) : \(string)
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.
$type | (string) Type of object affected by this color: ('draw', 'fill', 'text'). |
|
$color | (array) Array of colors (1=gray, 3=RGB, 4=CMYK or 5=spotcolor=CMYK+name values). |
|
$ret | (boolean) If true do not send the PDF command. |
The PDF command or empty string.
SetDrawColorArray( $color, $ret = false) : string
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.
$color | (array) Array of colors (1, 3 or 4 values). |
|
$ret | (boolean) If true do not send the PDF command. |
the PDF command
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.
$color | (array) Array of colors (1, 3 or 4 values). |
|
$ret | (boolean) If true do not send the PDF command. |
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.
$color | (array) Array of colors (1, 3 or 4 values). |
|
$ret | (boolean) If true do not send the PDF command. |
setColor( $type, $col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') : \(string)
Defines the color used by the specified type ('draw', 'fill', 'text').
$type | (string) Type of object affected by this color: ('draw', 'fill', 'text'). |
|
$col1 | (float) GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). |
|
$col2 | (float) GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). |
|
$col3 | (float) BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). |
|
$col4 | (float) KEY (BLACK) color for CMYK (0-100). |
|
$ret | (boolean) If true do not send the command. |
|
$name | (string) spot color name (if any) |
The PDF command or empty string.
SetDrawColor( $col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') : string
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.
$col1 | (float) GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). |
|
$col2 | (float) GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). |
|
$col3 | (float) BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). |
|
$col4 | (float) KEY (BLACK) color for CMYK (0-100). |
|
$ret | (boolean) If true do not send the command. |
|
$name | (string) spot color name (if any) |
the PDF command
SetFillColor( $col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') : \(string)
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.
$col1 | (float) GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). |
|
$col2 | (float) GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). |
|
$col3 | (float) BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). |
|
$col4 | (float) KEY (BLACK) color for CMYK (0-100). |
|
$ret | (boolean) If true do not send the command. |
|
$name | (string) Spot color name (if any). |
The PDF command.
SetTextColor( $col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') : \(string)
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.
$col1 | (float) GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100). |
|
$col2 | (float) GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100). |
|
$col3 | (float) BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100). |
|
$col4 | (float) KEY (BLACK) color for CMYK (0-100). |
|
$ret | (boolean) If true do not send the command. |
|
$name | (string) Spot color name (if any). |
Empty string.
GetStringWidth( $s, $fontname = '', $fontstyle = '', $fontsize, $getarray = false) : mixed
Returns the length of a string in user unit. A font must be selected.<br>
$s | (string) The string whose length is to be computed |
|
$fontname | (string) 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 | (string) Font style. Possible values are (case insensitive):
|
|
$fontsize | (float) Font size in points. The default value is the current size. |
|
$getarray | (boolean) if true returns an array of characters widths, if false returns the total length. |
int total string length or array of characted widths
GetArrStringWidth( $sa, $fontname = '', $fontstyle = '', $fontsize, $getarray = false) : mixed
Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.<br>
$sa | (string) The array of chars whose total length is to be computed |
|
$fontname | (string) 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 | (string) Font style. Possible values are (case insensitive):
|
|
$fontsize | (float) Font size in points. The default value is the current size. |
|
$getarray | (boolean) if true returns an array of characters widths, if false returns the total length. |
int total string length or array of characted widths
GetCharWidth( $char, $notlast = true) : float
Returns the length of the char in user unit for the current font considering current stretching and spacing (tracking).
$char | (int) The char code whose length is to be returned |
|
$notlast | (boolean) If false ignore the font-spacing. |
char width
AddFont( $family, $style = '', $fontfile = '', $subset = 'default') : array
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.
$family | (string) Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font. |
|
$style | (string) Font style. Possible values are (case insensitive):
|
|
$fontfile | (string) The font definition file. By default, the name is built from the family and style, in lower case with no spaces. |
|
$subset | (mixed) 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. |
containing the font data, or false in case of error.
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:
$family | (string) Family font. It can be either a name defined by AddFont() or one of the standard Type1 families (case insensitive):
|
|
$style | (string) Font style. Possible values are (case insensitive):
|
|
$size | (float) 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 | (string) The font definition file. By default, the name is built from the family and style, in lower case with no spaces. |
|
$subset | (mixed) 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 | (boolean) if true output the font size command, otherwise only set the font properties. |
isCharDefined( $char, $font = '', $style = '') : \(boolean)
Return true in the character is present in the specified font.
$char | (mixed) Character to check (integer value or string) |
|
$font | (string) Font name (family name). |
|
$style | (string) Font style. |
true if the char is defined, false otherwise.
replaceMissingChars( $text, $font = '', $style = '', $subs = array()) : \(string)
Replace missing font characters on selected font with specified substitutions.
$text | (string) Text to process. |
|
$font | (string) Font name (family name). |
|
$style | (string) Font style. |
|
$subs | (array) 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. |
Processed text.
SetLink( $link, $y, $page = -1)
Defines the page and position a link points to.
$link | (int) The link identifier returned by AddLink() |
|
$y | (float) Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page) |
|
$page | (int) 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. |
Link( $x, $y, $w, $h, $link, $spaces)
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.
$x | (float) Abscissa of the upper-left corner of the rectangle |
|
$y | (float) Ordinate of the upper-left corner of the rectangle |
|
$w | (float) Width of the rectangle |
|
$h | (float) Height of the rectangle |
|
$link | (mixed) URL or identifier returned by AddLink() |
|
$spaces | (int) number of spaces on the text to link |
Annotation( $x, $y, $w, $h, $text, $opt = array('Subtype' => 'Text'), $spaces)
Puts a markup annotation on a rectangular area of the page.
!!!!THE ANNOTATION SUPPORT IS NOT YET FULLY IMPLEMENTED !!!!
$x | (float) Abscissa of the upper-left corner of the rectangle |
|
$y | (float) Ordinate of the upper-left corner of the rectangle |
|
$w | (float) Width of the rectangle |
|
$h | (float) Height of the rectangle |
|
$text | (string) annotation text or alternate content |
|
$opt | (array) array of options (see section 8.4 of PDF reference 1.7). |
|
$spaces | (int) number of spaces on the text to link |
Text( $x, $y, $txt, $fstroke = false, $fclip = false, $ffill = true, $border, $ln, $align = '', $fill = false, $link = '', $stretch, $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.
$x | (float) Abscissa of the cell origin |
|
$y | (float) Ordinate of the cell origin |
|
$txt | (string) String to print |
|
$fstroke | (int) outline size in user units (false = disable) |
|
$fclip | (boolean) if true activate clipping mode (you must call StartTransform() before this function and StopTransform() to stop the clipping tranformation). |
|
$ffill | (boolean) if true fills the text |
|
$border | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
|
$ln | (int) Indicates where the current position should go after the call. Possible values are:
|
|
$align | (string) Allows to center or align the text. Possible values are:
|
|
$fill | (boolean) Indicates if the cell background must be painted (true) or transparent (false). |
|
$link | (mixed) URL or identifier returned by AddLink(). |
|
$stretch | (int) font stretch mode:
|
|
$ignore_min_height | (boolean) if true ignore automatic minimum height value. |
|
$calign | (string) cell vertical alignment relative to the specified Y value. Possible values are:
|
|
$valign | (string) text vertical alignment inside the cell. Possible values are:
|
|
$rtloff | (boolean) if true uses the page top-left corner as origin of axis for $x and $y initial position. |
AcceptPageBreak() : boolean
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.
Cell( $w, $h, $txt = '', $border, $ln, $align = '', $fill = false, $link = '', $stretch, $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.<br /> If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
$w | (float) Cell width. If 0, the cell extends up to the right margin. |
|
$h | (float) Cell height. Default value: 0. |
|
$txt | (string) String to print. Default value: empty string. |
|
$border | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
|
$ln | (int) Indicates where the current position should go after the call. Possible values are:
|
|
$align | (string) Allows to center or align the text. Possible values are:
|
|
$fill | (boolean) Indicates if the cell background must be painted (true) or transparent (false). |
|
$link | (mixed) URL or identifier returned by AddLink(). |
|
$stretch | (int) font stretch mode:
|
|
$ignore_min_height | (boolean) if true ignore automatic minimum height value. |
|
$calign | (string) cell vertical alignment relative to the specified Y value. Possible values are:
|
|
$valign | (string) text vertical alignment inside the cell. Possible values are:
|
MultiCell( $w, $h, $txt, $border, $align = 'J', $fill = false, $ln = 1, $x = '', $y = '', $reseth = true, $stretch, $ishtml = false, $autopadding = true, $maxh, $valign = 'T', $fitcell = false) : integer
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.
$w | (float) Width of cells. If 0, they extend up to the right margin of the page. |
|
$h | (float) Cell minimum height. The cell extends automatically if needed. |
|
$txt | (string) String to print |
|
$border | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
|
$align | (string) Allows to center or align the text. Possible values are:
|
|
$fill | (boolean) Indicates if the cell background must be painted (true) or transparent (false). |
|
$ln | (int) Indicates where the current position should go after the call. Possible values are:
|
|
$x | (float) x position in user units |
|
$y | (float) y position in user units |
|
$reseth | (boolean) if true reset the last cell height (default true). |
|
$stretch | (int) font stretch mode:
|
|
$ishtml | (boolean) 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 | (boolean) if true, uses internal padding and automatically adjust it to account for line width. |
|
$maxh | (float) 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 | (string) Vertical alignment of text (requires $maxh = $h > 0). Possible values are:
|
|
$fitcell | (boolean) 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. |
Return the number of cells or 1 for html mode.
getNumLines( $txt, $w, $reseth = false, $autopadding = true, $cellpadding = '', $border) : float
This method return the estimated number of lines for print a simple text string using Multicell() method.
$txt | (string) String for calculating his height |
|
$w | (float) Width of cells. If 0, they extend up to the right margin of the page. |
|
$reseth | (boolean) if true reset the last cell height (default false). |
|
$autopadding | (boolean) if true, uses internal padding and automatically adjust it to account for line width (default true). |
|
$cellpadding | (float) Internal cell padding, if empty uses default cell padding. |
|
$border | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
Return the minimal height needed for multicell method for printing the $txt param.
getStringHeight( $w, $txt, $reseth = false, $autopadding = true, $cellpadding = '', $border) : float
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:
$w | (float) Width of cells. If 0, they extend up to the right margin of the page. |
|
$txt | (string) String for calculating his height |
|
$reseth | (boolean) if true reset the last cell height (default false). |
|
$autopadding | (boolean) if true, uses internal padding and automatically adjust it to account for line width (default true). |
|
$cellpadding | (float) Internal cell padding, if empty uses default cell padding. |
|
$border | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
Return the minimal height needed for multicell method for printing the $txt param.
Write( $h, $txt, $link = '', $fill = false, $align = '', $ln = false, $stretch, $firstline = false, $firstblock = false, $maxh, $wadj, $margin = '') : mixed
This method prints text from the current position.<br />
$h | (float) Line height |
|
$txt | (string) String to print |
|
$link | (mixed) URL or identifier returned by AddLink() |
|
$fill | (boolean) Indicates if the cell background must be painted (true) or transparent (false). |
|
$align | (string) Allows to center or align the text. Possible values are:
|
|
$ln | (boolean) if true set cursor at the bottom of the line, otherwise set cursor at the top of the line. |
|
$stretch | (int) font stretch mode:
|
|
$firstline | (boolean) if true prints only the first line and return the remaining string. |
|
$firstblock | (boolean) if true the string is the starting of a line. |
|
$maxh | (float) maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature. |
|
$wadj | (float) first line width will be reduced by this amount (used in HTML mode). |
|
$margin | (array) margin array of the parent container |
Return the number of cells or the remaining string if $firstline = true.
Image( $file, $x = '', $y = '', $w, $h, $type = '', $link = '', $align = '', $resize = false, $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border, $fitbox = false, $hidden = false, $fitonpage = false, $alt = false, $altimgs = array()) : \image
Puts an image in the page.
The upper-left corner must be given. The dimensions can be specified in different ways:
$file | (string) 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 | (float) Abscissa of the upper-left corner (LTR) or upper-right corner (RTL). |
|
$y | (float) Ordinate of the upper-left corner (LTR) or upper-right corner (RTL). |
|
$w | (float) Width of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
$h | (float) Height of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
$type | (string) 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 | (mixed) URL or identifier returned by AddLink(). |
|
$align | (string) Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
|
|
$resize | (mixed) 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 | (int) dot-per-inch resolution used on resize |
|
$palign | (string) Allows to center or align the image on the current line. Possible values are:
|
|
$ismask | (boolean) true if this image is a mask, false otherwise |
|
$imgmask | (mixed) image object returned by this function or false |
|
$border | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
|
$fitbox | (mixed) 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 | (boolean) If true do not display the image. |
|
$fitonpage | (boolean) If true the image is resized to not exceed page dimensions. |
|
$alt | (boolean) If true the image will be added as alternative and not directly printed (the ID of the image will be returned). |
|
$altimgs | (array) 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. |
information
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.
$h | (float) The height of the break. By default, the value equals the height of the last printed cell. |
|
$cell | (boolean) if true add the current left (or right o for RTL) padding to the X coordinate |
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).
$x | (float) The value of the abscissa in user units. |
|
$rtloff | (boolean) if true always uses the page top-left corner as origin of axis. |
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.
$y | (float) The value of the ordinate in user units. |
|
$resetx | (bool) if true (default) reset the X position. |
|
$rtloff | (boolean) if true always uses the page top-left corner as origin of axis. |
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.
$x | (float) The value of the abscissa. |
|
$y | (float) The value of the ordinate. |
|
$rtloff | (boolean) if true always uses the page top-left corner as origin of axis. |
Output( $name = 'doc.pdf', $dest = 'I') : string
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.
$name | (string) The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character. |
|
$dest | (string) Destination where to send the document. It can take one of the following values:
|
_destroy( $destroyall = false, $preserve_objcopy = false)
Unset all class variables except the following critical variables.
$destroyall | (boolean) if true destroys all class variables, otherwise preserves critical variables. |
|
$preserve_objcopy | (boolean) if true preserves the objcopy variable |
addHtmlLink( $url, $name, $fill = false, $firstline = false, $color = '', $style = -1, $firstblock = false) : \the
Output anchor link.
$url | (string) link URL or internal link (i.e.: <a href="#23,4.5">link to page 23 at 4.5 Y position</a>) |
|
$name | (string) link name |
|
$fill | (boolean) Indicates if the cell background must be painted (true) or transparent (false). |
|
$firstline | (boolean) if true prints only the first line and return the remaining string. |
|
$color | (array) array of RGB text color |
|
$style | (string) font style (U, D, B, I) |
|
$firstblock | (boolean) if true the string is the starting of a line. |
number of cells used or the remaining text if $firstline = true;
SetProtection( $permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), $user_pass = '', $owner_pass = null, $mode, $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.
$permissions | (Array) the set of permissions (specify the ones you want to block):
|
|
$user_pass | (String) user password. Empty by default. |
|
$owner_pass | (String) owner password. If not specified, a random value is used. |
|
$mode | (int) encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit. |
|
$pubkeys | (String) 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'))) |
ScaleXY( $s, $x = '', $y = '')
Vertical and horizontal proportional Scaling.
$s | (float) scaling factor for width and height as percent. 0 is not allowed. |
|
$x | (int) abscissa of the scaling center. Default is current x position |
|
$y | (int) ordinate of the scaling center. Default is current y position |
Scale( $s_x, $s_y, $x = '', $y = '')
Vertical and horizontal non-proportional Scaling.
$s_x | (float) scaling factor for width as percent. 0 is not allowed. |
|
$s_y | (float) scaling factor for height as percent. 0 is not allowed. |
|
$x | (int) abscissa of the scaling center. Default is current x position |
|
$y | (int) ordinate of the scaling center. Default is current y position |
MirrorL( $angle, $x = '', $y = '')
Reflection against a straight line through point (x, y) with the gradient angle (angle).
$angle | (float) gradient angle of the straight line. Default is 0 (horizontal line). |
|
$x | (int) abscissa of the point. Default is current x position |
|
$y | (int) ordinate of the point. Default is current y position |
SkewX( $angle_x, $x = '', $y = '')
Skew horizontally.
$angle_x | (float) angle in degrees between -90 (skew to the left) and 90 (skew to the right) |
|
$x | (int) abscissa of the skewing center. default is current x position |
|
$y | (int) ordinate of the skewing center. default is current y position |
SkewY( $angle_y, $x = '', $y = '')
Skew vertically.
$angle_y | (float) angle in degrees between -90 (skew to the bottom) and 90 (skew to the top) |
|
$x | (int) abscissa of the skewing center. default is current x position |
|
$y | (int) ordinate of the skewing center. default is current y position |
Skew( $angle_x, $angle_y, $x = '', $y = '')
Skew.
$angle_x | (float) angle in degrees between -90 (skew to the left) and 90 (skew to the right) |
|
$angle_y | (float) angle in degrees between -90 (skew to the bottom) and 90 (skew to the top) |
|
$x | (int) abscissa of the skewing center. default is current x position |
|
$y | (int) ordinate of the skewing center. default is current y position |
SetLineStyle( $style, $ret = false) : string
Set line style.
$style | (array) Line style. Array with keys among the following:
|
|
$ret | (boolean) if true do not send the command. |
the PDF command
Line( $x1, $y1, $x2, $y2, $style = array())
Draws a line between two points.
$x1 | (float) Abscissa of first point. |
|
$y1 | (float) Ordinate of first point. |
|
$x2 | (float) Abscissa of second point. |
|
$y2 | (float) Ordinate of second point. |
|
$style | (array) Line style. Array like for SetLineStyle(). Default value: default line style (empty array). |
Rect( $x, $y, $w, $h, $style = '', $border_style = array(), $fill_color = array())
Draws a rectangle.
$x | (float) Abscissa of upper-left corner. |
|
$y | (float) Ordinate of upper-left corner. |
|
$w | (float) Width. |
|
$h | (float) Height. |
|
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$border_style | (array) Border style of rectangle. Array with keys among the following:
If a key is not present or is null, the correspondent border is not drawn. Default value: default line style (empty array). |
|
$fill_color | (array) 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). |
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.
$x0 | (float) Abscissa of start point. |
|
$y0 | (float) Ordinate of start point. |
|
$x1 | (float) Abscissa of control point 1. |
|
$y1 | (float) Ordinate of control point 1. |
|
$x2 | (float) Abscissa of control point 2. |
|
$y2 | (float) Ordinate of control point 2. |
|
$x3 | (float) Abscissa of end point. |
|
$y3 | (float) Ordinate of end point. |
|
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$line_style | (array) Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array). |
|
$fill_color | (array) 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). |
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.
$x0 | (float) Abscissa of start point. |
|
$y0 | (float) Ordinate of start point. |
|
$segments | (float) An array of bezier descriptions. Format: array(x1, y1, x2, y2, x3, y3). |
|
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$line_style | (array) Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array). |
|
$fill_color | (array) 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). |
Ellipse( $x0, $y0, $rx, $ry = '', $angle, $astart, $afinish = 360, $style = '', $line_style = array(), $fill_color = array(), $nc = 2)
Draws an ellipse.
An ellipse is formed from n Bezier curves.
$x0 | (float) Abscissa of center point. |
|
$y0 | (float) Ordinate of center point. |
|
$rx | (float) Horizontal radius. |
|
$ry | (float) Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0. |
|
$angle | ||
$astart | ||
$afinish | ||
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$line_style | (array) Line style of ellipse. Array like for SetLineStyle(). Default value: default line style (empty array). |
|
$fill_color | (array) 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 | (integer) Number of curves used to draw a 90 degrees portion of ellipse. |
Circle( $x0, $y0, $r, $angstr, $angend = 360, $style = '', $line_style = array(), $fill_color = array(), $nc = 2)
Draws a circle.
A circle is formed from n Bezier curves.
$x0 | (float) Abscissa of center point. |
|
$y0 | (float) Ordinate of center point. |
|
$r | (float) Radius. |
|
$angstr | ||
$angend | ||
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$line_style | (array) Line style of circle. Array like for SetLineStyle(). Default value: default line style (empty array). |
|
$fill_color | (array) Fill color. Format: array(red, green, blue). Default value: default color (empty array). |
|
$nc | (integer) Number of curves used to draw a 90 degrees portion of circle. |
PolyLine( $p, $style = '', $line_style = array(), $fill_color = array())
Draws a polygonal line
$p | (array) Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1)) |
|
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$line_style | (array) Line style of polygon. Array with keys among the following:
If a key is not present or is null, not draws the line. Default value is default line style (empty array). |
|
$fill_color | (array) 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). |
Polygon( $p, $style = '', $line_style = array(), $fill_color = array(), $closed = true)
Draws a polygon.
$p | (array) Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1)) |
|
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$line_style | (array) Line style of polygon. Array with keys among the following:
If a key is not present or is null, not draws the line. Default value is default line style (empty array). |
|
$fill_color | (array) 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 | (boolean) if true the polygon is closes, otherwise will remain open |
RegularPolygon( $x0, $y0, $r, $ns, $angle, $draw_circle = false, $style = '', $line_style = array(), $fill_color = array(), $circle_style = '', $circle_outLine_style = array(), $circle_fill_color = array())
Draws a regular polygon.
$x0 | (float) Abscissa of center point. |
|
$y0 | (float) Ordinate of center point. |
|
$r | ||
$ns | (integer) Number of sides. |
|
$angle | (float) Angle oriented (anti-clockwise). Default value: 0. |
|
$draw_circle | (boolean) Draw inscribed circle or not. Default value: false. |
|
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$line_style | (array) Line style of polygon sides. Array with keys among the following:
If a key is not present or is null, not draws the side. Default value is default line style (empty array). |
|
$fill_color | (array) Fill color. Format: array(red, green, blue). Default value: default color (empty array). |
|
$circle_style | (string) Style of rendering of inscribed circle (if draws). Possible values are:
|
|
$circle_outLine_style | (array) Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array). |
|
$circle_fill_color | (array) Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array). |
StarPolygon( $x0, $y0, $r, $nv, $ng, $angle, $draw_circle = false, $style = '', $line_style = array(), $fill_color = array(), $circle_style = '', $circle_outLine_style = array(), $circle_fill_color = array())
Draws a star polygon
$x0 | (float) Abscissa of center point. |
|
$y0 | (float) Ordinate of center point. |
|
$r | (float) Radius of inscribed circle. |
|
$nv | (integer) Number of vertices. |
|
$ng | (integer) Number of gap (if ($ng % $nv = 1) then is a regular polygon). |
|
$angle | ||
$draw_circle | ||
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$line_style | (array) Line style of polygon sides. Array with keys among the following:
If a key is not present or is null, not draws the side. Default value is default line style (empty array). |
|
$fill_color | (array) Fill color. Format: array(red, green, blue). Default value: default color (empty array). |
|
$circle_style | (string) Style of rendering of inscribed circle (if draws). Possible values are:
|
|
$circle_outLine_style | (array) Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array). |
|
$circle_fill_color | (array) Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array). |
RoundedRect( $x, $y, $w, $h, $r, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array())
Draws a rounded rectangle.
$x | (float) Abscissa of upper-left corner. |
|
$y | (float) Ordinate of upper-left corner. |
|
$w | (float) Width. |
|
$h | (float) Height. |
|
$r | (float) the radius of the circle used to round off the corners of the rectangle. |
|
$round_corner | (string) 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 | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$border_style | (array) Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array). |
|
$fill_color | (array) 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). |
RoundedRectXY( $x, $y, $w, $h, $rx, $ry, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array())
Draws a rounded rectangle.
$x | (float) Abscissa of upper-left corner. |
|
$y | (float) Ordinate of upper-left corner. |
|
$w | (float) Width. |
|
$h | (float) Height. |
|
$rx | (float) the x-axis radius of the ellipse used to round off the corners of the rectangle. |
|
$ry | (float) the y-axis radius of the ellipse used to round off the corners of the rectangle. |
|
$round_corner | (string) 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 | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$border_style | (array) Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array). |
|
$fill_color | (array) 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). |
Arrow( $x0, $y0, $x1, $y1, $head_style, $arm_size = 5, $arm_angle = 15)
Draws a grahic arrow.
$x0 | (float) Abscissa of first point. |
|
$y0 | (float) Ordinate of first point. |
|
$x1 | (float) Abscissa of second point. |
|
$y1 | (float) Ordinate of second point. |
|
$head_style | (int) (0 = draw only arrowhead arms, 1 = draw closed arrowhead, but no fill, 2 = closed and filled arrowhead, 3 = filled arrowhead) |
|
$arm_size | (float) length of arrowhead arms |
|
$arm_angle | (int) angle between an arm and the shaft |
setDestination( $name, $y = -1, $page = '', $x = -1) : \(string)
Add a Named Destination.
NOTE: destination names are unique, so only last entry will be saved.
$name | (string) Destination name. |
|
$y | (float) Y position in user units of the destiantion on the selected page (default = -1 = current position; 0 = page start;). |
|
$page | (int|string) 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 | (float) X position in user units of the destiantion on the selected page (default = -1 = current position;). |
Stripped named destination identifier or false in case of error.
setBookmark( $txt, $level, $y = -1, $page = '', $style = '', $color = array(0, 0, 0), $x = -1, $link = '')
Adds a bookmark - alias for Bookmark().
$txt | (string) Bookmark description. |
|
$level | (int) Bookmark level (minimum value is 0). |
|
$y | (float) Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;). |
|
$page | (int|string) 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 | (string) Font style: B = Bold, I = Italic, BI = Bold + Italic. |
|
$color | (array) RGB color array (values from 0 to 255). |
|
$x | (float) X position in user units of the bookmark on the selected page (default = -1 = current position;). |
|
$link | (mixed) URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name). |
Bookmark( $txt, $level, $y = -1, $page = '', $style = '', $color = array(0, 0, 0), $x = -1, $link = '')
Adds a bookmark.
$txt | (string) Bookmark description. |
|
$level | (int) Bookmark level (minimum value is 0). |
|
$y | (float) Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;). |
|
$page | (int|string) 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 | (string) Font style: B = Bold, I = Italic, BI = Bold + Italic. |
|
$color | (array) RGB color array (values from 0 to 255). |
|
$x | (float) X position in user units of the bookmark on the selected page (default = -1 = current position;). |
|
$link | (mixed) URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name). |
TextField( $name, $w, $h, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)
Creates a text field
$name | (string) field name |
|
$w | (float) Width of the rectangle |
|
$h | (float) Height of the rectangle |
|
$prop | (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. |
|
$opt | (array) annotation parameters. Possible values are described on official PDF32000_2008 reference. |
|
$x | (float) Abscissa of the upper-left corner of the rectangle |
|
$y | (float) Ordinate of the upper-left corner of the rectangle |
|
$js | (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered). |
RadioButton( $name, $w, $prop = array(), $opt = array(), $onvalue = 'On', $checked = false, $x = '', $y = '', $js = false)
Creates a RadioButton field.
$name | (string) Field name. |
|
$w | (int) Width of the radio button. |
|
$prop | (array) Javascript field properties. Possible values are described on official Javascript for Acrobat API reference. |
|
$opt | (array) Annotation parameters. Possible values are described on official PDF32000_2008 reference. |
|
$onvalue | (string) Value to be returned if selected. |
|
$checked | (boolean) Define the initial state. |
|
$x | (float) Abscissa of the upper-left corner of the rectangle |
|
$y | (float) Ordinate of the upper-left corner of the rectangle |
|
$js | (boolean) If true put the field using JavaScript (requires Acrobat Writer to be rendered). |
ListBox( $name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)
Creates a List-box field
$name | (string) field name |
|
$w | (int) width |
|
$h | (int) height |
|
$values | (array) array containing the list of values. |
|
$prop | (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. |
|
$opt | (array) annotation parameters. Possible values are described on official PDF32000_2008 reference. |
|
$x | (float) Abscissa of the upper-left corner of the rectangle |
|
$y | (float) Ordinate of the upper-left corner of the rectangle |
|
$js | (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered). |
ComboBox( $name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)
Creates a Combo-box field
$name | (string) field name |
|
$w | (int) width |
|
$h | (int) height |
|
$values | (array) array containing the list of values. |
|
$prop | (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. |
|
$opt | (array) annotation parameters. Possible values are described on official PDF32000_2008 reference. |
|
$x | (float) Abscissa of the upper-left corner of the rectangle |
|
$y | (float) Ordinate of the upper-left corner of the rectangle |
|
$js | (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered). |
CheckBox( $name, $w, $checked = false, $prop = array(), $opt = array(), $onvalue = 'Yes', $x = '', $y = '', $js = false)
Creates a CheckBox field
$name | (string) field name |
|
$w | (int) width |
|
$checked | (boolean) define the initial state. |
|
$prop | (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. |
|
$opt | (array) annotation parameters. Possible values are described on official PDF32000_2008 reference. |
|
$onvalue | (string) value to be returned if selected. |
|
$x | (float) Abscissa of the upper-left corner of the rectangle |
|
$y | (float) Ordinate of the upper-left corner of the rectangle |
|
$js | (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered). |
Button( $name, $w, $h, $caption, $action, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)
Creates a button field
$name | (string) field name |
|
$w | (int) width |
|
$h | (int) height |
|
$caption | (string) caption. |
|
$action | (mixed) 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 | (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. |
|
$opt | (array) annotation parameters. Possible values are described on official PDF32000_2008 reference. |
|
$x | (float) Abscissa of the upper-left corner of the rectangle |
|
$y | (float) Ordinate of the upper-left corner of the rectangle |
|
$js | (boolean) if true put the field using JavaScript (requires Acrobat Writer to be rendered). |
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
$enable | (boolean) if true enable user's rights on PDF reader |
|
$document | (string) 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 | (string) 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 | (string) Names specifying additional form-field-related usage rights for the document. Valid names are: /Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate |
|
$signature | (string) 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 | (string) 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 | (string) 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. |
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
$signing_cert | (mixed) signing certificate (string or filename prefixed with 'file://') |
|
$private_key | (mixed) private key (string or filename prefixed with 'file://') |
|
$private_key_password | (string) password |
|
$extracerts | (string) 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 | (int) 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) array of option information: Name, Location, Reason, ContactInfo. |
|
$approval | (string) Enable approval signature eg. for PDF incremental update |
setSignatureAppearance( $x, $y, $w, $h, $page = -1, $name = '')
Set the digital signature appearance (a cliccable rectangle area to get signature properties)
$x | (float) Abscissa of the upper-left corner. |
|
$y | (float) Ordinate of the upper-left corner. |
|
$w | (float) Width of the signature area. |
|
$h | (float) Height of the signature area. |
|
$page | (int) option page number (if < 0 the current page is used). |
|
$name | (string) Name of the signature. |
addEmptySignatureAppearance( $x, $y, $w, $h, $page = -1, $name = '')
Add an empty digital signature appearance (a cliccable rectangle area to get signature properties)
$x | (float) Abscissa of the upper-left corner. |
|
$y | (float) Ordinate of the upper-left corner. |
|
$w | (float) Width of the signature area. |
|
$h | (float) Height of the signature area. |
|
$page | (int) option page number (if < 0 the current page is used). |
|
$name | (string) Name of the signature. |
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!
$tsa_host | (string) Time Stamping Authority (TSA) server (prefixed with 'https://') |
|
$tsa_username | (string) Specifies the username for TSA authorization (optional) OR specifies the TSA authorization PEM file (see: example_66.php, optional) |
|
$tsa_password | (string) Specifies the password for TSA authorization (optional) |
|
$tsa_cert | (string) Specifies the location of TSA certificate for authorization (optional for cURL) |
getPageGroupAlias() : \alias
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.
of the current page group
getPageNumGroupAlias() : \alias
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).
of the current page group
startLayer( $name = '', $print = true, $view = true, $lock = true)
Start a new pdf layer.
$name | (string) Layer name (only a-z letters and numbers). Leave empty for automatic name. |
|
(boolean|null) Set to TRUE to print this layer, FALSE to not print and NULL to not set this option |
||
$view | (boolean) Set to true to view this layer. |
|
$lock | (boolean) If true lock the layer |
setOverprint( $stroking = true, $nonstroking = '', $mode)
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).
$stroking | (boolean) If true apply overprint for stroking operations. |
|
$nonstroking | (boolean) If true apply overprint for painting operations other than stroking. |
|
$mode | (integer) 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). |
setAlpha( $stroking = 1, $bm = 'Normal', $nonstroking = '', $ais = false)
Set alpha for stroking (CA) and non-stroking (ca) operations.
$stroking | (float) Alpha value for stroking operations: real value from 0 (transparent) to 1 (opaque). |
|
$bm | (string) blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity |
|
$nonstroking | (float) Alpha value for non-stroking operations: real value from 0 (transparent) to 1 (opaque). |
|
$ais | (boolean) |
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").
$preferences | (array) array of options. |
colorRegistrationBar( $x, $y, $w, $h, $transition = true, $vertical = false, $colors = 'A,R,G,B,C,M,Y,K')
Paints color transition registration bars
$x | (float) abscissa of the top left corner of the rectangle. |
|
$y | (float) ordinate of the top left corner of the rectangle. |
|
$w | (float) width of the rectangle. |
|
$h | (float) height of the rectangle. |
|
$transition | (boolean) if true prints tcolor transitions to white. |
|
$vertical | (boolean) if true prints bar vertically. |
|
$colors | (string) colors to print separated by comma. Valid values are: A,W,R,G,B,C,M,Y,K,RGB,CMYK,ALL,ALLSPOT, |
cropMark( $x, $y, $w, $h, $type = 'T,R,B,L', $color = array(100, 100, 100, 100, 'All'))
Paints crop marks.
$x | (float) abscissa of the crop mark center. |
|
$y | (float) ordinate of the crop mark center. |
|
$w | (float) width of the crop mark. |
|
$h | (float) height of the crop mark. |
|
$type | (string) 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 | (array) crop mark color (default spot registration color). |
registrationMark( $x, $y, $r, $double = false, $cola = array(100, 100, 100, 100, 'All'), $colb = array(0, 0, 0, 0, 'None'))
Paints a registration mark
$x | (float) abscissa of the registration mark center. |
|
$y | (float) ordinate of the registration mark center. |
|
$r | (float) radius of the crop mark. |
|
$double | (boolean) if true print two concentric crop marks. |
|
$cola | (array) crop mark color (default spot registration color 'All'). |
|
$colb | (array) second crop mark color (default spot registration color 'None'). |
LinearGradient( $x, $y, $w, $h, $col1 = array(), $col2 = array(), $coords = array(0, 0, 1, 0))
Paints a linear colour gradient.
$x | (float) abscissa of the top left corner of the rectangle. |
|
$y | (float) ordinate of the top left corner of the rectangle. |
|
$w | (float) width of the rectangle. |
|
$h | (float) height of the rectangle. |
|
$col1 | (array) first color (Grayscale, RGB or CMYK components). |
|
$col2 | (array) second color (Grayscale, RGB or CMYK components). |
|
$coords | (array) 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). |
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.
$x | (float) abscissa of the top left corner of the rectangle. |
|
$y | (float) ordinate of the top left corner of the rectangle. |
|
$w | (float) width of the rectangle. |
|
$h | (float) height of the rectangle. |
|
$col1 | (array) first color (Grayscale, RGB or CMYK components). |
|
$col2 | (array) second color (Grayscale, RGB or CMYK components). |
|
$coords | (array) 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. |
CoonsPatchMesh( $x, $y, $w, $h, $col1 = array(), $col2 = array(), $col3 = array(), $col4 = array(), $coords = array(0.0, 0.0, 0.33, 0.0, 0.67, 0.0, 1.0, 0.0, 1.0, 0.33, 1.0, 0.67, 1.0, 1.0, 0.67, 1.0, 0.33, 1.0, 0.0, 1.0, 0.0, 0.67, 0.0, 0.33), $coords_min, $coords_max = 1, $antialias = false)
Paints a coons patch mesh.
$x | (float) abscissa of the top left corner of the rectangle. |
|
$y | (float) ordinate of the top left corner of the rectangle. |
|
$w | (float) width of the rectangle. |
|
$h | (float) height of the rectangle. |
|
$col1 | (array) first color (lower left corner) (RGB components). |
|
$col2 | (array) second color (lower right corner) (RGB components). |
|
$col3 | (array) third color (upper right corner) (RGB components). |
|
$col4 | (array) fourth color (upper left corner) (RGB components). |
|
$coords | (array)
|
|
$coords_min | (array) 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 | (array) 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 | (boolean) A flag indicating whether to filter the shading function to prevent aliasing artifacts. |
Gradient( $type, $coords, $stops, $background = array(), $antialias = false)
Output gradient.
$type | (int) 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) array of coordinates. |
|
$stops | (array) 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 | (array) An array of colour components appropriate to the colour space, specifying a single background colour value. |
|
$antialias | (boolean) A flag indicating whether to filter the shading function to prevent aliasing artifacts. |
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.
$xc | (float) abscissa of the center. |
|
$yc | (float) ordinate of the center. |
|
$r | (float) radius. |
|
$a | (float) start angle (in degrees). |
|
$b | (float) end angle (in degrees). |
|
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$cw | ||
$o |
PieSectorXY( $xc, $yc, $rx, $ry, $a, $b, $style = 'FD', $cw = false, $o, $nc = 2)
Draw the sector of an ellipse.
It can be used for instance to render pie charts.
$xc | (float) abscissa of the center. |
|
$yc | (float) ordinate of the center. |
|
$rx | (float) the x-axis radius. |
|
$ry | (float) the y-axis radius. |
|
$a | (float) start angle (in degrees). |
|
$b | (float) end angle (in degrees). |
|
$style | (string) Style of rendering. See the getPathPaintOperator() function for more information. |
|
$cw | ||
$o | ||
$nc | (integer) Number of curves used to draw a 90 degrees portion of arc. |
ImageEps( $file, $x = '', $y = '', $w, $h, $link = '', $useBoundingBox = true, $align = '', $palign = '', $border, $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).
$file | (string) Name of the file containing the image or a '@' character followed by the EPS/AI data string. |
|
$x | (float) Abscissa of the upper-left corner. |
|
$y | (float) Ordinate of the upper-left corner. |
|
$w | (float) Width of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
$h | (float) Height of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
$link | (mixed) URL or identifier returned by AddLink(). |
|
$useBoundingBox | (boolean) specifies whether to position the bounding box (true) or the complete canvas (false) at location (x,y). Default value is true. |
|
$align | (string) Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
|
|
$palign | (string) Allows to center or align the image on the current line. Possible values are:
|
|
$border | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
|
$fitonpage | (boolean) if true the image is resized to not exceed page dimensions. |
|
$fixoutvals | (boolean) if true remove values outside the bounding box. |
write1DBarcode( $code, $type, $x = '', $y = '', $w = '', $h = '', $xres = '', $style = array(), $align = '')
Print a Linear Barcode.
$code | (string) code to print |
|
$type | (string) type of barcode (see tcpdf_barcodes_1d.php for supported formats). |
|
$x | (int) x position in user units (empty string = current x position) |
|
$y | (int) y position in user units (empty string = current y position) |
|
$w | (int) width in user units (empty string = remaining page width) |
|
$h | (int) height in user units (empty string = remaining page height) |
|
$xres | (float) width of the smallest bar in user units (empty string = default value = 0.4mm) |
|
$style | (array) array of options:
|
|
$align | (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
|
write2DBarcode( $code, $type, $x = '', $y = '', $w = '', $h = '', $style = array(), $align = '', $distort = false)
Print 2D Barcode.
$code | (string) code to print |
|
$type | (string) type of barcode (see tcpdf_barcodes_2d.php for supported formats). |
|
$x | (int) x position in user units |
|
$y | (int) y position in user units |
|
$w | (int) width in user units |
|
$h | (int) height in user units |
|
$style | (array) array of options:
|
|
$align | (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
|
|
$distort | (boolean) if true distort the barcode to fit width and height, otherwise preserve aspect ratio |
getMargins() : array
Returns an array containing current margins: <ul> <li>$ret['left'] = left margin</li> <li>$ret['right'] = right margin</li> <li>$ret['top'] = top margin</li> <li>$ret['bottom'] = bottom margin</li> <li>$ret['header'] = header margin</li> <li>$ret['footer'] = footer margin</li> <li>$ret['cell'] = cell padding array</li> <li>$ret['padding_left'] = cell left padding</li> <li>$ret['padding_top'] = cell top padding</li> <li>$ret['padding_right'] = cell right padding</li> <li>$ret['padding_bottom'] = cell bottom padding</li> </ul>
containing all margins measures
fixHTMLCode( $html, $default_css = '', $tagvs = '', $tidy_options = '') : string
Cleanup HTML code (requires HTML Tidy library).
$html | (string) htmlcode to fix |
|
$default_css | (string) CSS commands to add |
|
$tagvs | (array) parameters for setHtmlVSpace method |
|
$tidy_options | (array) options for tidy_parse_string function |
XHTML code cleaned up
getHTMLFontUnits( $val, $refsize = 12, $parent_size = 12, $defaultunit = 'pt') : float
Convert HTML string containing font size value to points
$val | (string) String containing font size value and unit. |
|
$refsize | (float) Reference font size in points. |
|
$parent_size | (float) Parent font size in points. |
|
$defaultunit | (string) Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt). |
value in points
writeHTMLCell( $w, $h, $x, $y, $html = '', $border, $ln, $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.
$w | (float) Cell width. If 0, the cell extends up to the right margin. |
|
$h | (float) Cell minimum height. The cell extends automatically if needed. |
|
$x | (float) upper-left corner X coordinate |
|
$y | (float) upper-left corner Y coordinate |
|
$html | (string) html text to print. Default value: empty string. |
|
$border | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
|
$ln | (int) Indicates where the current position should go after the call. Possible values are:
|
|
$fill | (boolean) Indicates if the cell background must be painted (true) or transparent (false). |
|
$reseth | (boolean) if true reset the last cell height (default true). |
|
$align | (string) Allows to center or align the text. Possible values are:
|
|
$autopadding | (boolean) if true, uses internal padding and automatically adjust it to account for line width. |
writeHTML( $html, $ln = true, $fill = false, $reseth = false, $cell = false, $align = '')
Allows to preserve some HTML formatting (limited support).<br /> 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.
$html | (string) text to display |
|
$ln | (boolean) if true add a new line after text (default = true) |
|
$fill | (boolean) Indicates if the background must be painted (true) or transparent (false). |
|
$reseth | (boolean) if true reset the last cell height (default false). |
|
$cell | (boolean) if true add the current left (or right for RTL) padding to each Write (default false). |
|
$align | (string) Allows to center or align the text. Possible values are:
|
setLIsymbol( $symbol = '!')
Set the default bullet to be used as LI bullet symbol
$symbol | (string) 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') |
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.
$tagvs | (array) array of tags and relative vertical spaces. |
getHTMLUnitToUnits( $htmlval, $refsize = 1, $defaultunit = 'px', $points = false) : float
Convert HTML string containing value and unit of measure to user's units or points.
$htmlval | (string) String containing values and unit. |
|
$refsize | (string) Reference value in points. |
|
$defaultunit | (string) Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt). |
|
$points | (boolean) If true returns points, otherwise returns value in user's units. |
value in user's unit or point if $points=true
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.
$page | (int) page number where this TOC should be inserted (leave empty for current page). |
|
$numbersfont | (string) set the font for page numbers (please use monospaced font for better alignment). |
|
$filler | (string) string used to fill the space between text and page number. |
|
$toc_name | (string) name to use for TOC bookmark. |
|
$style | (string) Font style for title: B = Bold, I = Italic, BI = Bold + Italic. |
|
$color | (array) RGB color array for bookmark title (values from 0 to 255). |
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.
$page | (int) page number where this TOC should be inserted (leave empty for current page). |
|
$toc_name | (string) name to use for TOC bookmark. |
|
$templates | (array) array of html templates. Use: "#TOC_DESCRIPTION#" for bookmark title, "#TOC_PAGE_NUMBER#" for page number. |
|
$correct_align | (boolean) 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 | (string) Font style for title: B = Bold, I = Italic, BI = Bold + Italic. |
|
$color | (array) RGB color array for title (values from 0 to 255). |
rollbackTransaction( $self = false) : \TCPDF
This method allows to undo the latest transaction by returning the latest saved TCPDF object with startTransaction().
$self | (boolean) if true restores current class object to previous state without the need of reassignment via the returned value. |
object.
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.
$params | (array) 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. |
hyphenateText( $text, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8) : array
Returns text with soft hyphens.
$text | (string) text to process |
|
$patterns | (mixed) 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) Array of words to be returned without applying the hyphenation algorithm. |
|
$leftmin | (int) Minimum number of character to leave on the left of the word without applying the hyphens. |
|
$rightmin | (int) Minimum number of character to leave on the right of the word without applying the hyphens. |
|
$charmin | (int) Minimum word length to apply the hyphenation algorithm. |
|
$charmax | (int) Maximum length of broken piece of word. |
text with soft hyphens
startTemplate( $w, $h, $group = false) : integer
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.
$w | (int) Template width in user units (empty string or zero = page width less margins). |
|
$h | (int) Template height in user units (empty string or zero = page height less margins). |
|
$group | (mixed) 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). |
the XObject Template ID in case of success or false in case of error.
endTemplate() : integer
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.
the XObject Template ID in case of success or false in case of error.
printTemplate( $id, $x = '', $y = '', $w, $h, $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.
$id | (string) The ID of XObject Template to print. |
|
$x | (int) X position in user units (empty string = current x position) |
|
$y | (int) Y position in user units (empty string = current y position) |
|
$w | (int) Width in user units (zero = remaining page width) |
|
$h | (int) Height in user units (zero = remaining page height) |
|
$align | (string) Indicates the alignment of the pointer next to template insertion relative to template height. The value can be:
|
|
$palign | (string) Allows to center or align the template on the current line. Possible values are:
|
|
$fitonpage | (boolean) If true the template is resized to not exceed page dimensions. |
setPageRegions( $regions = array())
Set no-write regions on page.
A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. A region is always aligned on the left or right side of the page ad is defined using a vertical segment. You can set multiple regions for the same page.
$regions | (array) array of no-write regions. For each region you can define an array as follow: ('page' => page number or empy for current page, 'xt' => X top, 'yt' => Y top, 'xb' => X bottom, 'yb' => Y bottom, 'side' => page side 'L' = left or 'R' = right). Omit this parameter to remove all regions. |
addPageRegion( $region)
Add a single no-write region on selected page.
A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. A region is always aligned on the left or right side of the page ad is defined using a vertical segment. You can set multiple regions for the same page.
$region | (array) array of a single no-write region array: ('page' => page number or empy for current page, 'xt' => X top, 'yt' => Y top, 'xb' => X bottom, 'yb' => Y bottom, 'side' => page side 'L' = left or 'R' = right). |
ImageSVG( $file, $x = '', $y = '', $w, $h, $link = '', $align = '', $palign = '', $border, $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.
$file | (string) Name of the SVG file or a '@' character followed by the SVG data string. |
|
$x | (float) Abscissa of the upper-left corner. |
|
$y | (float) Ordinate of the upper-left corner. |
|
$w | (float) Width of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
$h | (float) Height of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
$link | (mixed) URL or identifier returned by AddLink(). |
|
$align | (string) Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
|
|
$palign | (string) Allows to center or align the image on the current line. Possible values are:
|
|
$border | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
|
$fitonpage | (boolean) if true the image is resized to not exceed page dimensions. |
setPageFormat( $format, $orientation = 'P')
Change the format of the current page
$format | (mixed) 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:
|
|
$orientation | (string) page orientation. Possible values are (case insensitive):
|
adjustCellPadding( $brd) : array
Adjust the internal Cell padding array to take account of the line width.
$brd | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
of adjustments
checkPageBreak( $h, $y = '', $addpage = true) : boolean
Add page if needed.
$h | (float) Cell height. Default value: 0. |
|
$y | (mixed) starting y position, leave empty for current position. |
|
$addpage | (boolean) if true add a page, otherwise only return the true/false state |
true in case of page break, false otherwise.
getCellCode( $w, $h, $txt = '', $border, $ln, $align = '', $fill = false, $link = '', $stretch, $ignore_min_height = false, $calign = 'T', $valign = 'M') : string
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.<br /> If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
$w | (float) Cell width. If 0, the cell extends up to the right margin. |
|
$h | (float) Cell height. Default value: 0. |
|
$txt | (string) String to print. Default value: empty string. |
|
$border | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
|
$ln | (int) Indicates where the current position should go after the call. Possible values are:
|
|
$align | (string) Allows to center or align the text. Possible values are:
|
|
$fill | (boolean) Indicates if the cell background must be painted (true) or transparent (false). |
|
$link | (mixed) URL or identifier returned by AddLink(). |
|
$stretch | (int) font stretch mode:
|
|
$ignore_min_height | (boolean) if true ignore automatic minimum height value. |
|
$calign | (string) cell vertical alignment relative to the specified Y value. Possible values are:
|
|
$valign | (string) text vertical alignment inside the cell. Possible values are:
|
containing cell code
replaceChar( $oldchar, $newchar) : integer
Replace a char if is defined on the current font.
$oldchar | (int) Integer code (unicode) of the character to replace. |
|
$newchar | (int) Integer code (unicode) of the new character. |
the replaced char or the old char in case the new char i not defined
getCellBorder( $x, $y, $w, $h, $brd) : string
Returns the code to draw the cell border
$x | (float) X coordinate. |
|
$y | (float) Y coordinate. |
|
$w | (float) Cell width. |
|
$h | (float) Cell height. |
|
$brd | (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
|
containing cell border code
fitBlock( $w, $h, $x, $y, $fitonpage = false) : \array($w,
Set the block dimensions accounting for page breaks and page/column fitting
$w | (float) width |
|
$h | (float) height |
|
$x | (float) X coordinate |
|
$y | (float) Y coodiante |
|
$fitonpage | (boolean) if true the block is resized to not exceed page dimensions. |
$h, $x, $y)
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.
$file | (string) Name of the file containing the image. |
|
$x | (float) Abscissa of the upper-left corner. |
|
$y | (float) Ordinate of the upper-left corner. |
|
$wpx | (float) Original width of the image in pixels. |
|
$hpx | (float) original height of the image in pixels. |
|
$w | (float) Width of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
$h | (float) Height of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
$type | (string) 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 | (mixed) URL or identifier returned by AddLink(). |
|
$align | (string) Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:
|
|
$resize | (boolean) If true resize (reduce) the image to fit $w and $h (requires GD library). |
|
$dpi | (int) dot-per-inch resolution used on resize |
|
$palign | (string) Allows to center or align the image on the current line. Possible values are:
|
|
$filehash | (string) File hash used to build unique file names. |
replaceRightShiftPageNumAliases( $page, $aliases, $diff) : \replaced
Replace right shift page number aliases with spaces to correct right alignment.
This works perfectly only when using monospaced fonts.
$page | (string) Page content. |
|
$aliases | (array) Array of page aliases. |
|
$diff | (int) initial difference to add. |
page content.
_beginpage( $orientation = '', $format = '')
Initialize a new page.
$orientation | (string) page orientation. Possible values are (case insensitive):
|
|
$format | (mixed) 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(). |
_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.
$x | (float) Abscissa of upper-left corner. |
|
$y | (float) Ordinate of upper-left corner. |
|
$w | (float) Width. |
|
$h | (float) Height. |
|
$op | (string) options |
_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).
$x1 | (float) Abscissa of control point 1. |
|
$y1 | (float) Ordinate of control point 1. |
|
$x2 | (float) Abscissa of control point 2. |
|
$y2 | (float) Ordinate of control point 2. |
|
$x3 | (float) Abscissa of end point. |
|
$y3 | (float) Ordinate of end point. |
_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).
$x2 | (float) Abscissa of control point 2. |
|
$y2 | (float) Ordinate of control point 2. |
|
$x3 | (float) Abscissa of end point. |
|
$y3 | (float) Ordinate of end point. |
_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).
$x1 | (float) Abscissa of control point 1. |
|
$y1 | (float) Ordinate of control point 1. |
|
$x3 | (float) Abscissa of end point. |
|
$y3 | (float) Ordinate of end point. |
_outellipticalarc( $xc, $yc, $rx, $ry, $xang, $angs, $angf = 360, $pie = false, $nc = 2, $startpoint = true, $ccw = true, $svg = false) : array
Append an elliptical arc to the current path.
An ellipse is formed from n Bezier curves.
$xc | (float) Abscissa of center point. |
|
$yc | (float) Ordinate of center point. |
|
$rx | (float) Horizontal radius. |
|
$ry | (float) Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0. |
|
$xang | ||
$angs | ||
$angf | ||
$pie | (boolean) if true do not mark the border point (used to draw pie sectors). |
|
$nc | (integer) Number of curves used to draw a 90 degrees portion of ellipse. |
|
$startpoint | (boolean) if true output a starting point. |
|
$ccw | (boolean) if true draws in counter-clockwise. |
|
$svg | (boolean) if true the angles are in svg mode (already calculated). |
bounding box coordinates (x min, y min, x max, y max)
_addfield( $type, $name, $x, $y, $w, $h, $prop)
Adds a javascript form field.
$type | (string) field type |
|
$name | (string) field name |
|
$x | (int) horizontal position |
|
$y | (int) vertical position |
|
$w | (int) width |
|
$h | (int) height |
|
$prop | (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference. |
getSignatureAppearanceArray( $x, $y, $w, $h, $page = -1, $name = '') : \(array)
Get the array that defines the signature appearance (page and rectangle coordinates).
$x | (float) Abscissa of the upper-left corner. |
|
$y | (float) Ordinate of the upper-left corner. |
|
$w | (float) Width of the signature area. |
|
$h | (float) Height of the signature area. |
|
$page | (int) option page number (if < 0 the current page is used). |
|
$name | (string) Name of the signature. |
Array defining page and rectangle coordinates of signature appearance.
Clip( $x, $y, $w, $h)
Set a rectangular clipping area.
$x | (float) abscissa of the top left corner of the rectangle (or top right corner for RTL mode). |
|
$y | (float) ordinate of the top left corner of the rectangle. |
|
$w | (float) width of the rectangle. |
|
$h | (float) height of the rectangle. |
getCSSFontSpacing( $spacing, $parent) : float
Returns the letter-spacing value from CSS value
$spacing | (string) letter-spacing value |
|
$parent | (float) font spacing (tracking) value of the parent element |
quantity to increases or decreases the space between characters in a text.
closeHTMLTagHandler( $dom, $key, $cell, $maxbottomliney) : \$dom
Process closing tags.
$dom | (array) html dom array |
|
$key | (int) current element id |
|
$cell | (boolean) if true add the default left (or right if RTL) padding to each new line (default false). |
|
$maxbottomliney | (int) maximum y value of current line |
array
addHTMLVertSpace( $hbz, $hb, $cell = false, $firsttag = false, $lasttag = false)
Add vertical spaces if needed.
$hbz | (string) Distance between current y and line bottom. |
|
$hb | (string) The height of the break. |
|
$cell | (boolean) if true add the default left (or right if RTL) padding to each new line (default false). |
|
$firsttag | (boolean) set to true when the tag is the first. |
|
$lasttag | (boolean) set to true when the tag is the last. |
hyphenateWord( $word, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8) : array
Returns an array of chars containing soft hyphens.
$word | (array) array of chars |
|
$patterns | (array) Array of hypenation patterns. |
|
$dictionary | (array) Array of words to be returned without applying the hyphenation algorithm. |
|
$leftmin | (int) Minimum number of character to leave on the left of the word without applying the hyphens. |
|
$rightmin | (int) Minimum number of character to leave on the right of the word without applying the hyphens. |
|
$charmin | (int) Minimum word length to apply the hyphenation algorithm. |
|
$charmax | (int) Maximum length of broken piece of word. |
text with soft hyphens
checkPageRegions( $h, $x, $y) : \array($x,
Check page for no-write regions and adapt current coordinates and page margins if necessary.
A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. A region is always aligned on the left or right side of the page ad is defined using a vertical segment.
$h | (float) height of the text/image/object to print in user units |
|
$x | (float) current X coordinate in user units |
|
$y | (float) current Y coordinate in user units |
$y)
setSVGStyles( $svgstyle, $prevsvgstyle, $x, $y, $w = 1, $h = 1, $clip_function = '', $clip_params = array()) : object
Apply the requested SVG styles (*** TO BE COMPLETED ***)
$svgstyle | (array) array of SVG styles to apply |
|
$prevsvgstyle | (array) array of previous SVG style |
|
$x | (int) X origin of the bounding box |
|
$y | (int) Y origin of the bounding box |
|
$w | (int) width of the bounding box |
|
$h | (int) height of the bounding box |
|
$clip_function | (string) clip function |
|
$clip_params | (array) array of parameters for clipping function |
style
SVGPath( $d, $style = '') : array
Draws an SVG path
$d | (string) attribute d of the path SVG element |
|
$style | (string) Style of rendering. Possible values are:
|
of container box measures (x, y, w, h)
startSVGElementHandler( $parser, $name, $attribs, $ctm = array())
Sets the opening SVG element handler function for the XML parser. (*** TO BE COMPLETED ***)
$parser | (resource) The first parameter, parser, is a reference to the XML parser calling the handler. |
|
$name | (string) 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 | (array) 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 | (array) tranformation matrix for clipping mode (starting transformation matrix). |
endSVGElementHandler( $parser, $name)
Sets the closing SVG element handler function for the XML parser.
$parser | (resource) The first parameter, parser, is a reference to the XML parser calling the handler. |
|
$name | (string) 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. |
segSVGContentHandler( $parser, $data)
Sets the character data handler function for the XML parser.
$parser | (resource) The first parameter, parser, is a reference to the XML parser calling the handler. |
|
$data | (string) The second parameter, data, contains the character data as a string. |