class TCPDF


Located at : UKNOWVA_ROOT/libraries/tcpdf/tcpdf.php

Methods

__construct($orientation = 'P', $unit = 'mm', $format = 'A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false, $pdfa = false)

This is the class constructor.

__destruct()

Default destructor.

getTCPDFVersion()

Return the current TCPDF version.

setPageUnit($unit)

Set the units of measure for the document.

array
getPageSizeFromFormat($format)

Get page dimensions from format name.

setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points = false)

Set page boundaries.

setPageOrientation($orientation, $autopagebreak = '', $bottommargin = '')

Set page orientation.

setSpacesRE($re = '/[^\\S\\xa0]/')

Set regular expression to detect withespaces or word separators.

setRTL($enable, $resetx = true)

Enable or disable Right-To-Left language mode

boolean
getRTL()

Return the RTL status

setTempRTL($mode)

Force temporary RTL language direction

boolean
isRTLTextDir()

Return the current temporary RTL status

setLastH($h)

Set the last cell height.

resetLastH()

Reset the last cell height.

last
getLastH()

Get the last cell height.

setImageScale($scale)

Set the adjusting factor to convert pixels to user units.

float
getImageScale()

Returns the adjusting factor to convert pixels to user units.

array
getPageDimensions($pagenum = '')

Returns an array of page dimensions:

  • $this->pagedim[$this->page]['w'] = page width in points
  • $this->pagedim[$this->page]['h'] = height in points
  • $this->pagedim[$this->page]['wk'] = page width in user units
  • $this->pagedim[$this->page]['hk'] = page height in user units
  • $this->pagedim[$this->page]['tm'] = top margin
  • $this->pagedim[$this->page]['bm'] = bottom margin
  • $this->pagedim[$this->page]['lm'] = left margin
  • $this->pagedim[$this->page]['rm'] = right margin
  • $this->pagedim[$this->page]['pb'] = auto page break
  • $this->pagedim[$this->page]['or'] = page orientation
  • $this->pagedim[$this->page]['olm'] = original left margin
  • $this->pagedim[$this->page]['orm'] = original right margin
  • $this->pagedim[$this->page]['Rotate'] = The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
  • $this->pagedim[$this->page]['PZ'] = The page's preferred zoom (magnification) factor.
  • $this->pagedim[$this->page]['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
    • $this->pagedim[$this->page]['trans']['Dur'] = The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
    • $this->pagedim[$this->page]['trans']['S'] = transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
    • $this->pagedim[$this->page]['trans']['D'] = The duration of the transition effect, in seconds.
    • $this->pagedim[$this->page]['trans']['Dm'] = (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
    • $this->pagedim[$this->page]['trans']['M'] = (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
    • $this->pagedim[$this->page]['trans']['Di'] = (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
    • $this->pagedim[$this->page]['trans']['SS'] = (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
    • $this->pagedim[$this->page]['trans']['B'] = (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
  • $this->pagedim[$this->page]['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed
    • $this->pagedim[$this->page]['MediaBox']['llx'] = lower-left x coordinate in points
    • $this->pagedim[$this->page]['MediaBox']['lly'] = lower-left y coordinate in points
    • $this->pagedim[$this->page]['MediaBox']['urx'] = upper-right x coordinate in points
    • $this->pagedim[$this->page]['MediaBox']['ury'] = upper-right y coordinate in points
  • $this->pagedim[$this->page]['CropBox'] : the visible region of default user space
    • $this->pagedim[$this->page]['CropBox']['llx'] = lower-left x coordinate in points
    • $this->pagedim[$this->page]['CropBox']['lly'] = lower-left y coordinate in points
    • $this->pagedim[$this->page]['CropBox']['urx'] = upper-right x coordinate in points
    • $this->pagedim[$this->page]['CropBox']['ury'] = upper-right y coordinate in points
  • $this->pagedim[$this->page]['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment
    • $this->pagedim[$this->page]['BleedBox']['llx'] = lower-left x coordinate in points
    • $this->pagedim[$this->page]['BleedBox']['lly'] = lower-left y coordinate in points
    • $this->pagedim[$this->page]['BleedBox']['urx'] = upper-right x coordinate in points
    • $this->pagedim[$this->page]['BleedBox']['ury'] = upper-right y coordinate in points
  • $this->pagedim[$this->page]['TrimBox'] : the intended dimensions of the finished page after trimming
    • $this->pagedim[$this->page]['TrimBox']['llx'] = lower-left x coordinate in points
    • $this->pagedim[$this->page]['TrimBox']['lly'] = lower-left y coordinate in points
    • $this->pagedim[$this->page]['TrimBox']['urx'] = upper-right x coordinate in points
    • $this->pagedim[$this->page]['TrimBox']['ury'] = upper-right y coordinate in points
  • $this->pagedim[$this->page]['ArtBox'] : the extent of the page's meaningful content
    • $this->pagedim[$this->page]['ArtBox']['llx'] = lower-left x coordinate in points
    • $this->pagedim[$this->page]['ArtBox']['lly'] = lower-left y coordinate in points
    • $this->pagedim[$this->page]['ArtBox']['urx'] = upper-right x coordinate in points
    • $this->pagedim[$this->page]['ArtBox']['ury'] = upper-right y coordinate in points

int
getPageWidth($pagenum = '')

Returns the page width in units.

int
getPageHeight($pagenum = '')

Returns the page height in units.

int
getBreakMargin($pagenum = '')

Returns the page break margin.

int
getScaleFactor()

Returns the scale factor (number of points in user unit).

SetMargins($left, $top, $right = -1, $keepmargins = false)

Defines the left, top and right margins.

SetLeftMargin($margin)

Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.

SetTopMargin($margin)

Defines the top margin. The method can be called before creating the first page.

SetRightMargin($margin)

Defines the right margin. The method can be called before creating the first page.

SetCellPadding($pad)

Set the same internal Cell padding for top, right, bottom, left-

setCellPaddings($left = '', $top = '', $right = '', $bottom = '')

Set the internal Cell paddings.

array
getCellPaddings()

Get the internal Cell padding array.

setCellMargins($left = '', $top = '', $right = '', $bottom = '')

Set the internal Cell margins.

array
getCellMargins()

Get the internal Cell margin array.

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.

boolean
getAutoPageBreak()

Return the auto-page-break mode (true or false).

SetDisplayMode($zoom, $layout = 'SinglePage', $mode = 'UseNone')

Defines the way the document is to be displayed by the viewer.

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.

setSRGBmode($mode = false)

Set flag to force sRGB_IEC61966-2.1 black scaled ICC color profile for the whole document.

SetDocInfoUnicode($unicode = true)

Turn on/off Unicode mode for document information dictionary (meta tags).

SetTitle($title)

Defines the title of the document.

SetSubject($subject)

Defines the subject of the document.

SetAuthor($author)

Defines the author of the document.

SetKeywords($keywords)

Associates keywords with the document, generally in the form 'keyword1 keyword2 .

SetCreator($creator)

Defines the creator of the document. This is typically the name of the application that generates the PDF.

Error($msg)

This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid.

Open()

This method begins the generation of the PDF document.

Close()

Terminates the PDF document.

setPage($pnum, $resetmargins = false)

Move pointer at the specified document page and update page dimensions.

lastPage($resetmargins = false)

Reset pointer to the last document page.

int
getPage()

Get current document page number.

int
getNumPages()

Get the total number of insered pages.

addTOCPage($orientation = '', $format = '', $keepmargins = false)

Adds a new TOC (Table Of Content) page to the document.

endTOCPage()

Terminate the current TOC (Table Of Content) page

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).

endPage($tocpage = false)

Terminate the current page

startPage($orientation = '', $format = '', $tocpage = false)

Starts a new page to the document. The page must be closed using the endPage() function.

setPageMark()

Set start-writing mark on current page stream used to put borders and fills.

setHeaderData($ln = '', $lw, $ht = '', $hs = '', $tc = array(0, 0, 0), $lc = array(0, 0, 0))

Set header data.

setFooterData($tc = array(0, 0, 0), $lc = array(0, 0, 0))

Set footer data.

array()
getHeaderData()

Returns header data:

  • $ret['logo'] = logo image
  • $ret['logo_width'] = width of the image logo in user units
  • $ret['title'] = header title
  • $ret['string'] = header description string

setHeaderMargin($hm = 10)

Set header margin.

float
getHeaderMargin()

Returns header margin in user units.

setFooterMargin($fm = 10)

Set footer margin.

float
getFooterMargin()

Returns footer margin in user units.

setPrintHeader($val = true)

Set a flag to print page header.

setPrintFooter($val = true)

Set a flag to print page footer.

float
getImageRBX()

Return the right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image

float
getImageRBY()

Return the right-bottom (or left-bottom for RTL) corner Y coordinate of last inserted image

resetHeaderTemplate()

Reset the xobject template used by Header() method.

setHeaderTemplateAutoreset($val = true)

Set a flag to automatically reset the xobject template used by Header() method at each page.

Header()

This method is used to render the page header.

Footer()

This method is used to render the page footer.

int
PageNo()

Returns the current page number.

AddSpotColor($name, $c, $m, $y, $k)

Defines a new spot color.

(array)
getSpotColor($name)

Return the Spot color array.

(string)
setSpotColor($type, $name, $tint = 100)

Set the spot color for the specified type ('draw', 'fill', 'text').

SetDrawSpotColor($name, $tint = 100)

Defines the spot color used for all drawing operations (lines, rectangles and cell borders).

SetFillSpotColor($name, $tint = 100)

Defines the spot color used for all filling operations (filled rectangles and cell backgrounds).

SetTextSpotColor($name, $tint = 100)

Defines the spot color used for text.

(string)
setColorArray($type, $color, $ret = false)

Set the color array for the specified type ('draw', 'fill', 'text').

string
SetDrawColorArray($color, $ret = false)

Defines the color used for all drawing operations (lines, rectangles and cell borders).

SetFillColorArray($color, $ret = false)

Defines the color used for all filling operations (filled rectangles and cell backgrounds).

SetTextColorArray($color, $ret = false)

Defines the color used for text. It can be expressed in RGB components or gray scale.

(string)
setColor($type, $col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '')

Defines the color used by the specified type ('draw', 'fill', 'text').

string
SetDrawColor($col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '')

Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

(string)
SetFillColor($col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '')

Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

(string)
SetTextColor($col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '')

Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

mixed
GetStringWidth($s, $fontname = '', $fontstyle = '', $fontsize, $getarray = false)

Returns the length of a string in user unit. A font must be selected.

mixed
GetArrStringWidth($sa, $fontname = '', $fontstyle = '', $fontsize, $getarray = false)

Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.

float
GetCharWidth($char, $notlast = true)

Returns the length of the char in user unit for the current font considering current stretching and spacing (tracking).

float
getRawCharWidth($char)

Returns the length of the char in user unit for the current font.

int
GetNumChars($s)

Returns the numbero of characters in a string.

array
AddFont($family, $style = '', $fontfile = '', $subset = 'default')

Imports a TrueType, Type1, core, or CID0 font and makes it available.

SetFont($family, $style = '', $size = null, $fontfile = '', $subset = 'default', $out = true)

Sets the font used to print character strings.

SetFontSize($size, $out = true)

Defines the size of the current font.

array
getFontBBox()

Returns the bounding box of the current font in user units.

float
getAbsFontMeasure($s)

Convert a relative font measure into absolute value.

mixed
getCharBBox($char)

Returns the glyph bounding box of the specified character in the current font in user units.

int
getFontDescent($font, $style = '', $size)

Return the font descent value

int
getFontAscent($font, $style = '', $size)

Return the font ascent value.

(boolean)
isCharDefined($char, $font = '', $style = '')

Return true in the character is present in the specified font.

(string)
replaceMissingChars($text, $font = '', $style = '', $subs = array())

Replace missing font characters on selected font with specified substitutions.

SetDefaultMonospacedFont($font)

Defines the default monospaced font.

AddLink()

Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document.
The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().

SetLink($link, $y, $page = -1)

Defines the page and position a link points to.

Link($x, $y, $w, $h, $link, $spaces)

Puts a link on a rectangular area of the page.

Annotation($x, $y, $w, $h, $text, $opt = array('Subtype' => 'Text'), $spaces)

Puts a markup annotation on a rectangular area of the page.

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.

boolean
AcceptPageBreak()

Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value.

string
removeSHY($txt = '')

Removes SHY characters from text.

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.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.

int
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)

This method allows printing text with line breaks.

float
getNumLines($txt, $w, $reseth = false, $autopadding = true, $cellpadding = '', $border)

This method return the estimated number of lines for print a simple text string using Multicell() method.

float
getStringHeight($w, $txt, $reseth = false, $autopadding = true, $cellpadding = '', $border)

This method return the estimated height needed for printing a simple text string using the Multicell() method.

mixed
Write($h, $txt, $link = '', $fill = false, $align = '', $ln = false, $stretch, $firstline = false, $firstblock = false, $maxh, $wadj, $margin = '')

This method prints text from the current position.

Return
UTF8ArrSubString($strarr, $start = '', $end = '')

Extract a slice of the $strarr array and return it as string.

Return
UniArrSubString($uniarr, $start = '', $end = '')

Extract a slice of the $uniarr array and return it as string.

Return
UTF8ArrayToUniArray($ta)

Convert an array of UTF8 values to array of unicode characters

Returns
unichr($c)

Returns the unicode caracter specified by UTF-8 value

string
getImageFileType($imgfile, $iminfo = array())

Return the image type given the file name or array returned by getimagesize() function.

image
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())

Puts an image in the page.

set_mqr($mqr)

Sets the current active configuration setting of magicquotesruntime (if the setmagicquotes_runtime function exist)

Returns
get_mqr()

Gets the current active configuration setting of magicquotesruntime (if the getmagicquotes_runtime function exist)

Ln($h = '', $cell = false)

Performs a line break.

float
GetX()

Returns the relative X value of current position.

float
GetAbsX()

Returns the absolute X value of current position.

float
GetY()

Returns the ordinate of the current position.

SetX($x, $rtloff = false)

Defines the abscissa of the current position.

SetY($y, $resetx = true, $rtloff = false)

Moves the current abscissa back to the left margin and sets the ordinate.

SetXY($x, $y, $rtloff = false)

Defines the abscissa and ordinate of the current position.

SetAbsX($x)

Set the absolute X coordinate of the current pointer.

SetAbsY($y)

Set the absolute Y coordinate of the current pointer.

SetAbsXY($x, $y)

Set the absolute X and Y coordinates of the current pointer.

Output($name = 'doc.pdf', $dest = 'I')

Send the document to a given destination: string, local file or browser.

_destroy($destroyall = false, $preserve_objcopy = false)

Unset all class variables except the following critical variables: internal_encoding, state, bufferlen, buffer and diskcache.

(string)
addTTFfont($fontfile, $fonttype = '', $enc = '', $flags = 32, $outpath = '', $platid = 3, $encid = 1, $addcbbox = false)

Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable).

setExtraXMP($xmp)

Set additional XMP data to be added on the default XMP data just before the end of "x:xmpmeta" tag.

setDocCreationTimestamp($time)

Set the document creation timestamp

setDocModificationTimestamp($time)

Set the document modification timestamp

(int)
getDocCreationTimestamp()

Returns document creation timestamp in seconds.

(int)
getDocModificationTimestamp()

Returns document modification timestamp in seconds.

int
getTimestamp($date)

Returns timestamp in seconds from formatted date-time.

string
getFormattedDate($time)

Returns a formatted date-time.

setHeaderFont($font)

Set header font.

array()
getHeaderFont()

Get header font.

setFooterFont($font)

Set footer font.

array()
getFooterFont()

Get Footer font.

setLanguageArray($language)

Set language array.

getPDFData()

Returns the PDF data.

the
addHtmlLink($url, $name, $fill = false, $firstline = false, $color = '', $style = -1, $firstblock = false)

Output anchor link.

array
convertHTMLColorToDec($hcolor = '#FFFFFF', $defcol = array('R' => 128, 'G' => 128, 'B' => 128))

Returns an array (RGB or CMYK) from an html color name, or a six-digit (i.e. #3FE5AA), or three-digit (i.e. #7FF) hexadecimal color, or a javascript color array, or javascript color name.

float
pixelsToUnits($px)

Converts pixels to User's Units.

string
unhtmlentities($text_to_convert)

Reverse function for htmlentities.

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.

StartTransform()

Starts a 2D tranformation saving current graphic state.

StopTransform()

Stops a 2D tranformation restoring previous graphic state.

ScaleX($s_x, $x = '', $y = '')

Horizontal Scaling.

ScaleY($s_y, $x = '', $y = '')

Vertical Scaling.

ScaleXY($s, $x = '', $y = '')

Vertical and horizontal proportional Scaling.

Scale($s_x, $s_y, $x = '', $y = '')

Vertical and horizontal non-proportional Scaling.

MirrorH($x = '')

Horizontal Mirroring.

MirrorV($y = '')

Verical Mirroring.

MirrorP($x = '', $y = '')

Point reflection mirroring.

MirrorL($angle, $x = '', $y = '')

Reflection against a straight line through point (x, y) with the gradient angle (angle).

TranslateX($t_x)

Translate graphic object horizontally.

TranslateY($t_y)

Translate graphic object vertically.

Translate($t_x, $t_y)

Translate graphic object horizontally and vertically.

Rotate($angle, $x = '', $y = '')

Rotate object.

SkewX($angle_x, $x = '', $y = '')

Skew horizontally.

SkewY($angle_y, $x = '', $y = '')

Skew vertically.

Skew($angle_x, $angle_y, $x = '', $y = '')

Skew.

SetLineWidth($width)

Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.

int
GetLineWidth()

Returns the current the line width.

string
SetLineStyle($style, $ret = false)

Set line style.

Line($x1, $y1, $x2, $y2, $style = array())

Draws a line between two points.

Rect($x, $y, $w, $h, $style = '', $border_style = array(), $fill_color = array())

Draws a rectangle.

Curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, $style = '', $line_style = array(), $fill_color = array())

Draws a Bezier curve.

Polycurve($x0, $y0, $segments, $style = '', $line_style = array(), $fill_color = array())

Draws a poly-Bezier curve.

Ellipse($x0, $y0, $rx, $ry = '', $angle, $astart, $afinish = 360, $style = '', $line_style = array(), $fill_color = array(), $nc = 2)

Draws an ellipse.

Circle($x0, $y0, $r, $angstr, $angend = 360, $style = '', $line_style = array(), $fill_color = array(), $nc = 2)

Draws a circle.

PolyLine($p, $style = '', $line_style = array(), $fill_color = array())

Draws a polygonal line

Polygon($p, $style = '', $line_style = array(), $fill_color = array(), $closed = true)

Draws a polygon.

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.

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

RoundedRect($x, $y, $w, $h, $r, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array())

Draws a rounded rectangle.

RoundedRectXY($x, $y, $w, $h, $rx, $ry, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array())

Draws a rounded rectangle.

Arrow($x0, $y0, $x1, $y1, $head_style, $arm_size = 5, $arm_angle = 15)

Draws a grahic arrow.

(string)
setDestination($name, $y = -1, $page = '', $x = -1)

Add a Named Destination.

(array)
getDestination()

Return the Named Destination array.

setBookmark($txt, $level, $y = -1, $page = '', $style = '', $color = array(0, 0, 0))

Adds a bookmark - alias for Bookmark().

Bookmark($txt, $level, $y = -1, $page = '', $style = '', $color = array(0, 0, 0), $x = -1)

Adds a bookmark.

IncludeJS($script)

Adds a javascript

int
addJavascriptObject($script, $onload = false)

Adds a javascript object and return object ID

setFormDefaultProp($prop = array())

Set default properties for form fields.

array
getFormDefaultProp()

Return the default properties for form fields.

TextField($name, $w, $h, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)

Creates a text field

RadioButton($name, $w, $prop = array(), $opt = array(), $onvalue = 'On', $checked = false, $x = '', $y = '', $js = false)

Creates a RadioButton field.

ListBox($name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)

Creates a List-box field

ComboBox($name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)

Creates a Combo-box field

CheckBox($name, $w, $checked = false, $prop = array(), $opt = array(), $onvalue = 'Yes', $x = '', $y = '', $js = false)

Creates a CheckBox field

Button($name, $w, $h, $caption, $action, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)

Creates a button field

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.

setSignature($signing_cert = '', $private_key = '', $private_key_password = '', $extracerts = '', $cert_type = 2, $info = array())

Enable document signature (requires the OpenSSL Library).

setSignatureAppearance($x, $y, $w, $h, $page = -1)

Set the digital signature appearance (a cliccable rectangle area to get signature properties)

addEmptySignatureAppearance($x, $y, $w, $h, $page = -1)

Add an empty digital signature appearance (a cliccable rectangle area to get signature properties)

startPageGroup($page = '')

Create a new page group.

AliasNbPages($s = '') deprecated

This method is DEPRECATED and doesn't have any effect.

AliasNumPage($s = '') deprecated

This method is DEPRECATED and doesn't have any effect.

setStartingPageNumber($num = 1)

Set the starting page number.

string
getAliasRightShift()

Returns the string alias used right align page numbers.

string
getAliasNbPages()

Returns the string alias used for the total number of pages.

string
getAliasNumPage()

Returns the string alias used for the page number.

alias
getPageGroupAlias()

Return the alias for the total number of pages in the current page group.

alias
getPageNumGroupAlias()

Return the alias for the page number on the current page group.

current
getGroupPageNo()

Return the current page in the group.

getGroupPageNoFormatted()

Returns the current group page number formatted as a string.

PageNoFormatted()

Returns the current page number formatted as a string.

startLayer($name = '', $print = true, $view = true)

Start a new pdf layer.

endLayer()

End the current PDF layer.

setVisibility($v)

Set the visibility of the successive elements.

setOverprint($stroking = true, $nonstroking = '', $mode)

Set overprint mode for stroking (OP) and non-stroking (op) painting operations.

array.
getOverprint()

Get the overprint mode array (OP, op, OPM).

setAlpha($stroking = 1, $bm = 'Normal', $nonstroking = '', $ais = false)

Set alpha for stroking (CA) and non-stroking (ca) operations.

array.
getAlpha()

Get the alpha mode array (CA, ca, BM, AIS).

setJPEGQuality($quality)

Set the default JPEG compression quality (1-100)

setDefaultTableColumns($cols = 4)

Set the default number of columns in a row for HTML tables.

setCellHeightRatio($h)

Set the height of the cell (line height) respect the font height.

getCellHeightRatio()

return the height of cell repect font height.

setPDFVersion($version = '1.7')

Set the PDF version (check PDF reference for valid values).

setViewerPreferences($preferences)

Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.

colorRegistrationBar($x, $y, $w, $h, $transition = true, $vertical = false, $colors = 'A,R,G,B,C,M,Y,K')

Paints color transition registration bars

cropMark($x, $y, $w, $h, $type = 'T,R,B,L', $color = array(0, 0, 0))

Paints crop marks.

registrationMark($x, $y, $r, $double = false, $cola = array(0, 0, 0), $colb = array(255, 255, 255))

Paints a registration mark

LinearGradient($x, $y, $w, $h, $col1 = array(), $col2 = array(), $coords = array(0, 0, 1, 0))

Paints a linear colour gradient.

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.

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.

Gradient($type, $coords, $stops, $background = array(), $antialias = false)

Output gradient.

_putshaders()

Output gradient shaders.

PieSector($xc, $yc, $r, $a, $b, $style = 'FD', $cw = true, $o = 90)

Draw the sector of a circle.

PieSectorXY($xc, $yc, $rx, $ry, $a, $b, $style = 'FD', $cw = false, $o, $nc = 2)

Draw the sector of an ellipse.

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.

setBarcode($bc = '')

Set document barcode.

string
getBarcode()

Get current barcode.

write1DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $xres = '', $style = '', $align = '')

Print a Linear Barcode.

writeBarcode($x, $y, $w, $h, $type, $style, $font, $xres, $code) deprecated

This function is DEPRECATED, please use the new write1DBarcode() function.

write2DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $style = '', $align = '', $distort = false)

Print 2D Barcode.

array
getMargins()

Returns an array containing current margins:

  • $ret['left'] = left margin
  • $ret['right'] = right margin
  • $ret['top'] = top margin
  • $ret['bottom'] = bottom margin
  • $ret['header'] = header margin
  • $ret['footer'] = footer margin
  • $ret['cell'] = cell padding array
  • $ret['padding_left'] = cell left padding
  • $ret['padding_top'] = cell top padding
  • $ret['padding_right'] = cell right padding
  • $ret['padding_bottom'] = cell bottom padding

array
getOriginalMargins()

Returns an array containing original margins:

  • $ret['left'] = left margin
  • $ret['right'] = right margin

current
getFontSize()

Returns the current font size.

current
getFontSizePt()

Returns the current font size in points unit.

string
getFontFamily()

Returns the current font family name.

string
getFontStyle()

Returns the current font style.

string
fixHTMLCode($html, $default_css = '', $tagvs = '', $tidy_options = '')

Cleanup HTML code (requires HTML Tidy library).

array
getCSSPadding($csspadding, $width)

Get the internal Cell padding from CSS attribute.

array
getCSSMargin($cssmargin, $width)

Get the internal Cell margin from CSS attribute.

array
getCSSBorderMargin($cssbspace, $width)

Get the border-spacing from CSS attribute.

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.

writeHTML($html, $ln = true, $fill = false, $reseth = false, $cell = false, $align = '')

Allows to preserve some HTML formatting (limited support).
IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting.

setLIsymbol($symbol = '!')

Set the default bullet to be used as LI bullet symbol

SetBooklet($booklet = true, $inner = -1, $outer = -1)

Set the booklet mode for double-sided pages.

setHtmlVSpace($tagvs)

Set the vertical spaces for HTML tags.

setListIndentWidth($width)

Set custom width for list indentation.

setOpenCell($isopen)

Set the top/bottom cell sides to be open or closed when the cell cross the page.

setHtmlLinksStyle($color = array(0, 0, 255), $fontstyle = 'U')

Set the color and font style for HTML links.

float
getHTMLUnitToUnits($htmlval, $refsize = 1, $defaultunit = 'px', $points = false)

Convert HTML string containing value and unit of measure to user's units or points.

string
intToRoman($number)

Returns the Roman representation of an integer number

true
movePage($frompage, $topage)

Move a page to a previous position.

true
deletePage($page)

Remove the specified page.

true
copyPage($page)

Clone the specified page to a new page.

addTOC($page = '', $numbersfont = '', $filler = '.', $toc_name = 'TOC', $style = '', $color = array(0, 0, 0))

Output a Table of Content Index (TOC).

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.

startTransaction()

Stores a copy of the current TCPDF object used for undo operation.

commitTransaction()

Delete the copy of the current TCPDF object used for undo operation.

rollbackTransaction($self = false)

This method allows to undo the latest transaction by returning the latest saved TCPDF object with startTransaction().

cloned
objclone($object)

Creates a copy of a class object

boolean
empty_string($str)

Determine whether a string is empty.

Returns
revstrpos($haystack, $needle, $offset)

Find position of last occurrence of a substring in a string

setEqualColumns($numcols, $width, $y = '')

Set multiple columns of the same size

resetColumns()

Remove columns and reset page margins.

setColumnsArray($columns)

Set columns array.

selectColumn($col = '')

Set position at a given column

int
getColumn()

Return the current column number

int
getNumberOfColumns()

Return the current number of columns.

sting
serializeTCPDFtagParameters($pararray)

Serialize an array of parameters to be used with TCPDF tag in HTML code.

setTextRenderingMode($stroke, $fill = true, $clip = false)

Set Text rendering mode.

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.

Array
getTextShadow()

Return the text shadow parameters array.

array
getHyphenPatternsFromTEX($file)

Returns an array of hyphenation patterns.

array
hyphenateText($text, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8)

Returns text with soft hyphens.

setRasterizeVectorImages($mode)

Enable/disable rasterization of vector images using ImageMagick library.

setFontSubsetting($enable = true)

Enable or disable default option for font subsetting.

boolean
getFontSubsetting()

Return the default option for font subsetting.

left
stringLeftTrim($str, $replace = '')

Left trim the input string

right
stringRightTrim($str, $replace = '')

Right trim the input string

trimmed
stringTrim($str, $replace = '')

Trim the input string

true
isUnicodeFont()

Return true if the current font is unicode type.

string
getFontFamilyName($fontfamily)

Return normalized font name

int
startTemplate($w, $h, $group = false)

Start a new XObject Template.

int
endTemplate()

End the current XObject Template started with startTemplate() and restore the previous graphic state.

printTemplate($id, $x = '', $y = '', $w, $h, $align = '', $palign = '', $fitonpage = false)

Print an XObject Template.

setFontStretching($perc = 100)

Set the percentage of character stretching.

float
getFontStretching()

Get the percentage of character stretching.

setFontSpacing($spacing)

Set the amount to increase or decrease the space between characters in a text.

int
getFontSpacing()

Get the amount to increase or decrease the space between characters in a text.

array
getPageRegions()

Return an array of no-write page regions

setPageRegions($regions = array())

Set no-write regions on page.

addPageRegion($region)

Add a single no-write region on selected page.

removePageRegion($key)

Remove a single no-write region.

ImageSVG($file, $x = '', $y = '', $w, $h, $link = '', $align = '', $palign = '', $border, $fitonpage = false)

Embedd a Scalable Vector Graphics (SVG) image.

Details

at line 1949
__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).

Parameters

$orientation (string) page orientation. Possible values are (case insensitive):
  • P or Portrait (default)
  • L or Landscape
  • '' (empty string) for automatic orientation
$unit (string) User measure unit. Possible values are:
  • pt: point
  • mm: millimeter (default)
  • cm: centimeter
  • in: inch

A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
$format (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; default is UTF-8.
$diskcache (boolean) If TRUE reduce the RAM memory usage by caching temporary data on filesystem (slower).
$pdfa (boolean) If TRUE set the document to PDF/A mode.

See also

getPageSizeFromFormat(), setPageFormat()

at line 2113
__destruct()

Default destructor.

at line 2128
TCPDF getTCPDFVersion()

Return the current TCPDF version.

Return Value

TCPDF version string

at line 2138
setPageUnit($unit)

Set the units of measure for the document.

Parameters

$unit (string) User measure unit. Possible values are:
  • pt: point
  • mm: millimeter (default)
  • cm: centimeter
  • in: inch

A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.

at line 2489
array getPageSizeFromFormat($format)

Get page dimensions from format name.

Parameters

$format (mixed) The format name. It can be:
  • ISO 216 A Series + 2 SIS 014711 extensions
  • A0 (841x1189 mm ; 33.11x46.81 in)
  • A1 (594x841 mm ; 23.39x33.11 in)
  • A2 (420x594 mm ; 16.54x23.39 in)
  • A3 (297x420 mm ; 11.69x16.54 in)
  • A4 (210x297 mm ; 8.27x11.69 in)
  • A5 (148x210 mm ; 5.83x8.27 in)
  • A6 (105x148 mm ; 4.13x5.83 in)
  • A7 (74x105 mm ; 2.91x4.13 in)
  • A8 (52x74 mm ; 2.05x2.91 in)
  • A9 (37x52 mm ; 1.46x2.05 in)
  • A10 (26x37 mm ; 1.02x1.46 in)
  • A11 (18x26 mm ; 0.71x1.02 in)
  • A12 (13x18 mm ; 0.51x0.71 in)
  • ISO 216 B Series + 2 SIS 014711 extensions
  • B0 (1000x1414 mm ; 39.37x55.67 in)
  • B1 (707x1000 mm ; 27.83x39.37 in)
  • B2 (500x707 mm ; 19.69x27.83 in)
  • B3 (353x500 mm ; 13.90x19.69 in)
  • B4 (250x353 mm ; 9.84x13.90 in)
  • B5 (176x250 mm ; 6.93x9.84 in)
  • B6 (125x176 mm ; 4.92x6.93 in)
  • B7 (88x125 mm ; 3.46x4.92 in)
  • B8 (62x88 mm ; 2.44x3.46 in)
  • B9 (44x62 mm ; 1.73x2.44 in)
  • B10 (31x44 mm ; 1.22x1.73 in)
  • B11 (22x31 mm ; 0.87x1.22 in)
  • B12 (15x22 mm ; 0.59x0.87 in)
  • ISO 216 C Series + 2 SIS 014711 extensions + 2 EXTENSION
  • C0 (917x1297 mm ; 36.10x51.06 in)
  • C1 (648x917 mm ; 25.51x36.10 in)
  • C2 (458x648 mm ; 18.03x25.51 in)
  • C3 (324x458 mm ; 12.76x18.03 in)
  • C4 (229x324 mm ; 9.02x12.76 in)
  • C5 (162x229 mm ; 6.38x9.02 in)
  • C6 (114x162 mm ; 4.49x6.38 in)
  • C7 (81x114 mm ; 3.19x4.49 in)
  • C8 (57x81 mm ; 2.24x3.19 in)
  • C9 (40x57 mm ; 1.57x2.24 in)
  • C10 (28x40 mm ; 1.10x1.57 in)
  • C11 (20x28 mm ; 0.79x1.10 in)
  • C12 (14x20 mm ; 0.55x0.79 in)
  • C76 (81x162 mm ; 3.19x6.38 in)
  • DL (110x220 mm ; 4.33x8.66 in)
  • SIS 014711 E Series
  • E0 (879x1241 mm ; 34.61x48.86 in)
  • E1 (620x879 mm ; 24.41x34.61 in)
  • E2 (440x620 mm ; 17.32x24.41 in)
  • E3 (310x440 mm ; 12.20x17.32 in)
  • E4 (220x310 mm ; 8.66x12.20 in)
  • E5 (155x220 mm ; 6.10x8.66 in)
  • E6 (110x155 mm ; 4.33x6.10 in)
  • E7 (78x110 mm ; 3.07x4.33 in)
  • E8 (55x78 mm ; 2.17x3.07 in)
  • E9 (39x55 mm ; 1.54x2.17 in)
  • E10 (27x39 mm ; 1.06x1.54 in)
  • E11 (19x27 mm ; 0.75x1.06 in)
  • E12 (13x19 mm ; 0.51x0.75 in)
  • SIS 014711 G Series
  • G0 (958x1354 mm ; 37.72x53.31 in)
  • G1 (677x958 mm ; 26.65x37.72 in)
  • G2 (479x677 mm ; 18.86x26.65 in)
  • G3 (338x479 mm ; 13.31x18.86 in)
  • G4 (239x338 mm ; 9.41x13.31 in)
  • G5 (169x239 mm ; 6.65x9.41 in)
  • G6 (119x169 mm ; 4.69x6.65 in)
  • G7 (84x119 mm ; 3.31x4.69 in)
  • G8 (59x84 mm ; 2.32x3.31 in)
  • G9 (42x59 mm ; 1.65x2.32 in)
  • G10 (29x42 mm ; 1.14x1.65 in)
  • G11 (21x29 mm ; 0.83x1.14 in)
  • G12 (14x21 mm ; 0.55x0.83 in)
  • ISO Press
  • RA0 (860x1220 mm ; 33.86x48.03 in)
  • RA1 (610x860 mm ; 24.02x33.86 in)
  • RA2 (430x610 mm ; 16.93x24.02 in)
  • RA3 (305x430 mm ; 12.01x16.93 in)
  • RA4 (215x305 mm ; 8.46x12.01 in)
  • SRA0 (900x1280 mm ; 35.43x50.39 in)
  • SRA1 (640x900 mm ; 25.20x35.43 in)
  • SRA2 (450x640 mm ; 17.72x25.20 in)
  • SRA3 (320x450 mm ; 12.60x17.72 in)
  • SRA4 (225x320 mm ; 8.86x12.60 in)
  • German DIN 476
  • 4A0 (1682x2378 mm ; 66.22x93.62 in)
  • 2A0 (1189x1682 mm ; 46.81x66.22 in)
  • Variations on the ISO Standard
  • A2EXTRA (445x619 mm ; 17.52x24.37 in)
  • A3+ (329x483 mm ; 12.95x19.02 in)
  • A3EXTRA (322x445 mm ; 12.68x17.52 in)
  • A3SUPER (305x508 mm ; 12.01x20.00 in)
  • SUPERA3 (305x487 mm ; 12.01x19.17 in)
  • A4EXTRA (235x322 mm ; 9.25x12.68 in)
  • A4SUPER (229x322 mm ; 9.02x12.68 in)
  • SUPERA4 (227x356 mm ; 8.94x14.02 in)
  • A4LONG (210x348 mm ; 8.27x13.70 in)
  • F4 (210x330 mm ; 8.27x12.99 in)
  • SOB5EXTRA (202x276 mm ; 7.95x10.87 in)
  • A5EXTRA (173x235 mm ; 6.81x9.25 in)
  • ANSI Series
  • ANSIE (864x1118 mm ; 34.00x44.00 in)
  • ANSID (559x864 mm ; 22.00x34.00 in)
  • ANSIC (432x559 mm ; 17.00x22.00 in)
  • ANSIB (279x432 mm ; 11.00x17.00 in)
  • ANSIA (216x279 mm ; 8.50x11.00 in)
  • Traditional 'Loose' North American Paper Sizes
  • LEDGER, USLEDGER (432x279 mm ; 17.00x11.00 in)
  • TABLOID, USTABLOID, BIBLE, ORGANIZERK (279x432 mm ; 11.00x17.00 in)
  • LETTER, USLETTER, ORGANIZERM (216x279 mm ; 8.50x11.00 in)
  • LEGAL, USLEGAL (216x356 mm ; 8.50x14.00 in)
  • GLETTER, GOVERNMENTLETTER (203x267 mm ; 8.00x10.50 in)
  • JLEGAL, JUNIORLEGAL (203x127 mm ; 8.00x5.00 in)
  • Other North American Paper Sizes
  • QUADDEMY (889x1143 mm ; 35.00x45.00 in)
  • SUPERB (330x483 mm ; 13.00x19.00 in)
  • QUARTO (229x279 mm ; 9.00x11.00 in)
  • FOLIO, GOVERNMENTLEGAL (216x330 mm ; 8.50x13.00 in)
  • EXECUTIVE, MONARCH (184x267 mm ; 7.25x10.50 in)
  • MEMO, STATEMENT, ORGANIZERL (140x216 mm ; 5.50x8.50 in)
  • FOOLSCAP (210x330 mm ; 8.27x13.00 in)
  • COMPACT (108x171 mm ; 4.25x6.75 in)
  • ORGANIZERJ (70x127 mm ; 2.75x5.00 in)
  • Canadian standard CAN 2-9.60M
  • P1 (560x860 mm ; 22.05x33.86 in)
  • P2 (430x560 mm ; 16.93x22.05 in)
  • P3 (280x430 mm ; 11.02x16.93 in)
  • P4 (215x280 mm ; 8.46x11.02 in)
  • P5 (140x215 mm ; 5.51x8.46 in)
  • P6 (107x140 mm ; 4.21x5.51 in)
  • North American Architectural Sizes
  • ARCHE (914x1219 mm ; 36.00x48.00 in)
  • ARCHE1 (762x1067 mm ; 30.00x42.00 in)
  • ARCHD (610x914 mm ; 24.00x36.00 in)
  • ARCHC, BROADSHEET (457x610 mm ; 18.00x24.00 in)
  • ARCHB (305x457 mm ; 12.00x18.00 in)
  • ARCHA (229x305 mm ; 9.00x12.00 in)
  • Announcement Envelopes
  • ANNENVA2 (111x146 mm ; 4.37x5.75 in)
  • ANNENVA6 (121x165 mm ; 4.75x6.50 in)
  • ANNENVA7 (133x184 mm ; 5.25x7.25 in)
  • ANNENVA8 (140x206 mm ; 5.50x8.12 in)
  • ANNENVA10 (159x244 mm ; 6.25x9.62 in)
  • ANNENVSLIM (98x225 mm ; 3.87x8.87 in)
  • Commercial Envelopes
  • COMMENVN61/4 (89x152 mm ; 3.50x6.00 in)
  • COMMENVN63/4 (92x165 mm ; 3.62x6.50 in)
  • COMMENVN8 (98x191 mm ; 3.87x7.50 in)
  • COMMENVN9 (98x225 mm ; 3.87x8.87 in)
  • COMMENVN10 (105x241 mm ; 4.12x9.50 in)
  • COMMENVN11 (114x263 mm ; 4.50x10.37 in)
  • COMMENVN12 (121x279 mm ; 4.75x11.00 in)
  • COMMENVN14 (127x292 mm ; 5.00x11.50 in)
  • Catalogue Envelopes
  • CATENVN1 (152x229 mm ; 6.00x9.00 in)
  • CATENVN13/4 (165x241 mm ; 6.50x9.50 in)
  • CATENVN2 (165x254 mm ; 6.50x10.00 in)
  • CATENVN3 (178x254 mm ; 7.00x10.00 in)
  • CATENVN6 (191x267 mm ; 7.50x10.50 in)
  • CATENVN7 (203x279 mm ; 8.00x11.00 in)
  • CATENVN8 (210x286 mm ; 8.25x11.25 in)
  • CATENVN91/2 (216x267 mm ; 8.50x10.50 in)
  • CATENVN93/4 (222x286 mm ; 8.75x11.25 in)
  • CATENVN101/2 (229x305 mm ; 9.00x12.00 in)
  • CATENVN121/2 (241x318 mm ; 9.50x12.50 in)
  • CATENVN131/2 (254x330 mm ; 10.00x13.00 in)
  • CATENVN141/4 (286x311 mm ; 11.25x12.25 in)
  • CATENVN141/2 (292x368 mm ; 11.50x14.50 in)
  • Japanese (JIS P 0138-61) Standard B-Series
  • JISB0 (1030x1456 mm ; 40.55x57.32 in)
  • JISB1 (728x1030 mm ; 28.66x40.55 in)
  • JISB2 (515x728 mm ; 20.28x28.66 in)
  • JISB3 (364x515 mm ; 14.33x20.28 in)
  • JISB4 (257x364 mm ; 10.12x14.33 in)
  • JISB5 (182x257 mm ; 7.17x10.12 in)
  • JISB6 (128x182 mm ; 5.04x7.17 in)
  • JISB7 (91x128 mm ; 3.58x5.04 in)
  • JISB8 (64x91 mm ; 2.52x3.58 in)
  • JISB9 (45x64 mm ; 1.77x2.52 in)
  • JISB10 (32x45 mm ; 1.26x1.77 in)
  • JISB11 (22x32 mm ; 0.87x1.26 in)
  • JISB12 (16x22 mm ; 0.63x0.87 in)
  • PA Series
  • PA0 (840x1120 mm ; 33.07x44.09 in)
  • PA1 (560x840 mm ; 22.05x33.07 in)
  • PA2 (420x560 mm ; 16.54x22.05 in)
  • PA3 (280x420 mm ; 11.02x16.54 in)
  • PA4 (210x280 mm ; 8.27x11.02 in)
  • PA5 (140x210 mm ; 5.51x8.27 in)
  • PA6 (105x140 mm ; 4.13x5.51 in)
  • PA7 (70x105 mm ; 2.76x4.13 in)
  • PA8 (52x70 mm ; 2.05x2.76 in)
  • PA9 (35x52 mm ; 1.38x2.05 in)
  • PA10 (26x35 mm ; 1.02x1.38 in)
  • Standard Photographic Print Sizes
  • PASSPORTPHOTO (35x45 mm ; 1.38x1.77 in)
  • E (82x120 mm ; 3.25x4.72 in)
  • 3R, L (89x127 mm ; 3.50x5.00 in)
  • 4R, KG (102x152 mm ; 4.02x5.98 in)
  • 4D (120x152 mm ; 4.72x5.98 in)
  • 5R, 2L (127x178 mm ; 5.00x7.01 in)
  • 6R, 8P (152x203 mm ; 5.98x7.99 in)
  • 8R, 6P (203x254 mm ; 7.99x10.00 in)
  • S8R, 6PW (203x305 mm ; 7.99x12.01 in)
  • 10R, 4P (254x305 mm ; 10.00x12.01 in)
  • S10R, 4PW (254x381 mm ; 10.00x15.00 in)
  • 11R (279x356 mm ; 10.98x14.02 in)
  • S11R (279x432 mm ; 10.98x17.01 in)
  • 12R (305x381 mm ; 12.01x15.00 in)
  • S12R (305x456 mm ; 12.01x17.95 in)
  • Common Newspaper Sizes
  • NEWSPAPERBROADSHEET (750x600 mm ; 29.53x23.62 in)
  • NEWSPAPERBERLINER (470x315 mm ; 18.50x12.40 in)
  • NEWSPAPERCOMPACT, NEWSPAPERTABLOID (430x280 mm ; 16.93x11.02 in)
  • Business Cards
  • CREDITCARD, BUSINESSCARD, BUSINESSCARDISO7810 (54x86 mm ; 2.13x3.37 in)
  • BUSINESSCARDISO216 (52x74 mm ; 2.05x2.91 in)
  • BUSINESSCARDIT, BUSINESSCARDUK, BUSINESSCARDFR, BUSINESSCARDDE, BUSINESSCARDES (55x85 mm ; 2.17x3.35 in)
  • BUSINESSCARDUS, BUSINESSCARDCA (51x89 mm ; 2.01x3.50 in)
  • BUSINESSCARDJP (55x91 mm ; 2.17x3.58 in)
  • BUSINESSCARDHK (54x90 mm ; 2.13x3.54 in)
  • BUSINESSCARDAU, BUSINESSCARDDK, BUSINESSCARDSE (55x90 mm ; 2.17x3.54 in)
  • BUSINESSCARDRU, BUSINESSCARDCZ, BUSINESSCARDFI, BUSINESSCARDHU, BUSINESSCARDIL (50x90 mm ; 1.97x3.54 in)
  • Billboards
  • 4SHEET (1016x1524 mm ; 40.00x60.00 in)
  • 6SHEET (1200x1800 mm ; 47.24x70.87 in)
  • 12SHEET (3048x1524 mm ; 120.00x60.00 in)
  • 16SHEET (2032x3048 mm ; 80.00x120.00 in)
  • 32SHEET (4064x3048 mm ; 160.00x120.00 in)
  • 48SHEET (6096x3048 mm ; 240.00x120.00 in)
  • 64SHEET (8128x3048 mm ; 320.00x120.00 in)
  • 96SHEET (12192x3048 mm ; 480.00x120.00 in)
  • Old Imperial English (some are still used in USA)
  • ENEMPEROR (1219x1829 mm ; 48.00x72.00 in)
  • ENANTIQUARIAN (787x1346 mm ; 31.00x53.00 in)
  • ENGRANDEAGLE (730x1067 mm ; 28.75x42.00 in)
  • ENDOUBLEELEPHANT (679x1016 mm ; 26.75x40.00 in)
  • ENATLAS (660x864 mm ; 26.00x34.00 in)
  • ENCOLOMBIER (597x876 mm ; 23.50x34.50 in)
  • ENELEPHANT (584x711 mm ; 23.00x28.00 in)
  • ENDOUBLEDEMY (572x902 mm ; 22.50x35.50 in)
  • ENIMPERIAL (559x762 mm ; 22.00x30.00 in)
  • ENPRINCESS (546x711 mm ; 21.50x28.00 in)
  • ENCARTRIDGE (533x660 mm ; 21.00x26.00 in)
  • ENDOUBLELARGEPOST (533x838 mm ; 21.00x33.00 in)
  • ENROYAL (508x635 mm ; 20.00x25.00 in)
  • ENSHEET, ENHALFPOST (495x597 mm ; 19.50x23.50 in)
  • ENSUPERROYAL (483x686 mm ; 19.00x27.00 in)
  • ENDOUBLEPOST (483x775 mm ; 19.00x30.50 in)
  • ENMEDIUM (445x584 mm ; 17.50x23.00 in)
  • ENDEMY (445x572 mm ; 17.50x22.50 in)
  • ENLARGEPOST (419x533 mm ; 16.50x21.00 in)
  • ENCOPYDRAUGHT (406x508 mm ; 16.00x20.00 in)
  • ENPOST (394x489 mm ; 15.50x19.25 in)
  • ENCROWN (381x508 mm ; 15.00x20.00 in)
  • ENPINCHEDPOST (375x470 mm ; 14.75x18.50 in)
  • ENBRIEF (343x406 mm ; 13.50x16.00 in)
  • ENFOOLSCAP (343x432 mm ; 13.50x17.00 in)
  • ENSMALLFOOLSCAP (337x419 mm ; 13.25x16.50 in)
  • ENPOTT (318x381 mm ; 12.50x15.00 in)
  • Old Imperial Belgian
  • BEGRANDAIGLE (700x1040 mm ; 27.56x40.94 in)
  • BECOLOMBIER (620x850 mm ; 24.41x33.46 in)
  • BEDOUBLECARRE (620x920 mm ; 24.41x36.22 in)
  • BEELEPHANT (616x770 mm ; 24.25x30.31 in)
  • BEPETITAIGLE (600x840 mm ; 23.62x33.07 in)
  • BEGRANDJESUS (550x730 mm ; 21.65x28.74 in)
  • BEJESUS (540x730 mm ; 21.26x28.74 in)
  • BERAISIN (500x650 mm ; 19.69x25.59 in)
  • BEGRANDMEDIAN (460x605 mm ; 18.11x23.82 in)
  • BEDOUBLEPOSTE (435x565 mm ; 17.13x22.24 in)
  • BECOQUILLE (430x560 mm ; 16.93x22.05 in)
  • BEPETITMEDIAN (415x530 mm ; 16.34x20.87 in)
  • BERUCHE (360x460 mm ; 14.17x18.11 in)
  • BEPROPATRIA (345x430 mm ; 13.58x16.93 in)
  • BELYS (317x397 mm ; 12.48x15.63 in)
  • BEPOT (307x384 mm ; 12.09x15.12 in)
  • BEROSETTE (270x347 mm ; 10.63x13.66 in)
  • Old Imperial French
  • FRUNIVERS (1000x1300 mm ; 39.37x51.18 in)
  • FRDOUBLECOLOMBIER (900x1260 mm ; 35.43x49.61 in)
  • FRGRANDEMONDE (900x1260 mm ; 35.43x49.61 in)
  • FRDOUBLESOLEIL (800x1200 mm ; 31.50x47.24 in)
  • FRDOUBLEJESUS (760x1120 mm ; 29.92x44.09 in)
  • FRGRANDAIGLE (750x1060 mm ; 29.53x41.73 in)
  • FRPETITAIGLE (700x940 mm ; 27.56x37.01 in)
  • FRDOUBLERAISIN (650x1000 mm ; 25.59x39.37 in)
  • FRJOURNAL (650x940 mm ; 25.59x37.01 in)
  • FRCOLOMBIERAFFICHE (630x900 mm ; 24.80x35.43 in)
  • FRDOUBLECAVALIER (620x920 mm ; 24.41x36.22 in)
  • FRCLOCHE (600x800 mm ; 23.62x31.50 in)
  • FRSOLEIL (600x800 mm ; 23.62x31.50 in)
  • FRDOUBLECARRE (560x900 mm ; 22.05x35.43 in)
  • FRDOUBLECOQUILLE (560x880 mm ; 22.05x34.65 in)
  • FRJESUS (560x760 mm ; 22.05x29.92 in)
  • FRRAISIN (500x650 mm ; 19.69x25.59 in)
  • FRCAVALIER (460x620 mm ; 18.11x24.41 in)
  • FRDOUBLECOURONNE (460x720 mm ; 18.11x28.35 in)
  • FRCARRE (450x560 mm ; 17.72x22.05 in)
  • FRCOQUILLE (440x560 mm ; 17.32x22.05 in)
  • FRDOUBLETELLIERE (440x680 mm ; 17.32x26.77 in)
  • FRDOUBLECLOCHE (400x600 mm ; 15.75x23.62 in)
  • FRDOUBLEPOT (400x620 mm ; 15.75x24.41 in)
  • FRECU (400x520 mm ; 15.75x20.47 in)
  • FRCOURONNE (360x460 mm ; 14.17x18.11 in)
  • FRTELLIERE (340x440 mm ; 13.39x17.32 in)
  • FRPOT (310x400 mm ; 12.20x15.75 in)

Return Value

array containing page width and height in points

at line 3016
setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points = false)

Set page boundaries.

Parameters

$page (int) page number
$type (string) valid values are:
  • 'MediaBox' : the boundaries of the physical medium on which the page shall be displayed or printed;
  • 'CropBox' : the visible region of default user space;
  • 'BleedBox' : the region to which the contents of the page shall be clipped when output in a production environment;
  • 'TrimBox' : the intended dimensions of the finished page after trimming;
  • 'ArtBox' : the page's meaningful content (including potential white space).
$llx (float) lower-left x coordinate in user units
$lly (float) lower-left y coordinate in user units
$urx (float) upper-right x coordinate in user units
$ury (float) upper-right y coordinate in user units
$points (boolean) if true uses user units as unit of measure, otherwise uses PDF points

at line 3065
setPageOrientation($orientation, $autopagebreak = '', $bottommargin = '')

Set page orientation.

Parameters

$orientation (string) page orientation. Possible values are (case insensitive):
  • P or Portrait (default)
  • L or Landscape
  • '' (empty string) for automatic orientation
$autopagebreak (boolean) Boolean indicating if auto-page-break mode should be on or off.
$bottommargin (float) bottom margin of the page.

at line 3170
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: "/[^\S\P{Z}\xa0]/u"
Unicode and PCRE unicode support in Chinese mode: "/[^\S\P{Z}\P{Lo}\xa0]/u"
if PCRE unicode support is turned ON ("\P" is the negate class of "\p"):
"\p{Z}" or "\p{Separator}": any kind of Unicode whitespace or invisible separator.
"\p{Lo}" or "\p{Other_Letter}": a Unicode letter or ideograph that does not have lowercase and uppercase variants.
"\p{Lo}" is needed for Chinese characters because are packed next to each other without spaces in between.

Parameters

$re (string) regular expression (leave empty for default).

at line 3195
setRTL($enable, $resetx = true)

Enable or disable Right-To-Left language mode

Parameters

$enable (Boolean) if true enable Right-To-Left language mode.
$resetx (Boolean) if true reset the X position on direction change.

at line 3211
boolean getRTL()

Return the RTL status

Return Value

boolean

at line 3221
setTempRTL($mode)

Force temporary RTL language direction

Parameters

$mode (mixed) can be false, 'L' for LTR or 'R' for RTL

at line 3253
boolean isRTLTextDir()

Return the current temporary RTL status

Return Value

boolean

at line 3264
setLastH($h)

Set the last cell height.

Parameters

$h (float) cell height.

at line 3273
resetLastH()

Reset the last cell height.

at line 3283
last getLastH()

Get the last cell height.

Return Value

last cell height

at line 3294
setImageScale($scale)

Set the adjusting factor to convert pixels to user units.

Parameters

$scale (float) adjusting factor to convert pixels to user units.

at line 3305
float getImageScale()

Returns the adjusting factor to convert pixels to user units.

Return Value

float adjusting factor to convert pixels to user units.

at line 3318
array getPageDimensions($pagenum = '')

Returns an array of page dimensions:

  • $this->pagedim[$this->page]['w'] = page width in points
  • $this->pagedim[$this->page]['h'] = height in points
  • $this->pagedim[$this->page]['wk'] = page width in user units
  • $this->pagedim[$this->page]['hk'] = page height in user units
  • $this->pagedim[$this->page]['tm'] = top margin
  • $this->pagedim[$this->page]['bm'] = bottom margin
  • $this->pagedim[$this->page]['lm'] = left margin
  • $this->pagedim[$this->page]['rm'] = right margin
  • $this->pagedim[$this->page]['pb'] = auto page break
  • $this->pagedim[$this->page]['or'] = page orientation
  • $this->pagedim[$this->page]['olm'] = original left margin
  • $this->pagedim[$this->page]['orm'] = original right margin
  • $this->pagedim[$this->page]['Rotate'] = The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
  • $this->pagedim[$this->page]['PZ'] = The page's preferred zoom (magnification) factor.
  • $this->pagedim[$this->page]['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
    • $this->pagedim[$this->page]['trans']['Dur'] = The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
    • $this->pagedim[$this->page]['trans']['S'] = transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
    • $this->pagedim[$this->page]['trans']['D'] = The duration of the transition effect, in seconds.
    • $this->pagedim[$this->page]['trans']['Dm'] = (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
    • $this->pagedim[$this->page]['trans']['M'] = (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
    • $this->pagedim[$this->page]['trans']['Di'] = (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
    • $this->pagedim[$this->page]['trans']['SS'] = (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
    • $this->pagedim[$this->page]['trans']['B'] = (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
  • $this->pagedim[$this->page]['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed
    • $this->pagedim[$this->page]['MediaBox']['llx'] = lower-left x coordinate in points
    • $this->pagedim[$this->page]['MediaBox']['lly'] = lower-left y coordinate in points
    • $this->pagedim[$this->page]['MediaBox']['urx'] = upper-right x coordinate in points
    • $this->pagedim[$this->page]['MediaBox']['ury'] = upper-right y coordinate in points
  • $this->pagedim[$this->page]['CropBox'] : the visible region of default user space
    • $this->pagedim[$this->page]['CropBox']['llx'] = lower-left x coordinate in points
    • $this->pagedim[$this->page]['CropBox']['lly'] = lower-left y coordinate in points
    • $this->pagedim[$this->page]['CropBox']['urx'] = upper-right x coordinate in points
    • $this->pagedim[$this->page]['CropBox']['ury'] = upper-right y coordinate in points
  • $this->pagedim[$this->page]['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment
    • $this->pagedim[$this->page]['BleedBox']['llx'] = lower-left x coordinate in points
    • $this->pagedim[$this->page]['BleedBox']['lly'] = lower-left y coordinate in points
    • $this->pagedim[$this->page]['BleedBox']['urx'] = upper-right x coordinate in points
    • $this->pagedim[$this->page]['BleedBox']['ury'] = upper-right y coordinate in points
  • $this->pagedim[$this->page]['TrimBox'] : the intended dimensions of the finished page after trimming
    • $this->pagedim[$this->page]['TrimBox']['llx'] = lower-left x coordinate in points
    • $this->pagedim[$this->page]['TrimBox']['lly'] = lower-left y coordinate in points
    • $this->pagedim[$this->page]['TrimBox']['urx'] = upper-right x coordinate in points
    • $this->pagedim[$this->page]['TrimBox']['ury'] = upper-right y coordinate in points
  • $this->pagedim[$this->page]['ArtBox'] : the extent of the page's meaningful content
    • $this->pagedim[$this->page]['ArtBox']['llx'] = lower-left x coordinate in points
    • $this->pagedim[$this->page]['ArtBox']['lly'] = lower-left y coordinate in points
    • $this->pagedim[$this->page]['ArtBox']['urx'] = upper-right x coordinate in points
    • $this->pagedim[$this->page]['ArtBox']['ury'] = upper-right y coordinate in points

Parameters

$pagenum (int) page number (empty = current page)

Return Value

array of page dimensions.

at line 3334
int getPageWidth($pagenum = '')

Returns the page width in units.

Parameters

$pagenum (int) page number (empty = current page)

Return Value

int page width.

See also

getPageDimensions()

at line 3350
int getPageHeight($pagenum = '')

Returns the page height in units.

Parameters

$pagenum (int) page number (empty = current page)

Return Value

int page height.

See also

getPageDimensions()

at line 3366
int getBreakMargin($pagenum = '')

Returns the page break margin.

Parameters

$pagenum (int) page number (empty = current page)

Return Value

int page break margin.

See also

getPageDimensions()

at line 3380
int getScaleFactor()

Returns the scale factor (number of points in user unit).

Return Value

int scale factor.

at line 3394
SetMargins($left, $top, $right = -1, $keepmargins = false)

Defines the left, top and right margins.

Parameters

$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

See also

SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak()

at line 3416
SetLeftMargin($margin)

Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.

Parameters

$margin (float) The margin.

See also

SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins()

at line 3431
SetTopMargin($margin)

Defines the top margin. The method can be called before creating the first page.

Parameters

$margin (float) The margin.

See also

SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins()

at line 3446
SetRightMargin($margin)

Defines the right margin. The method can be called before creating the first page.

Parameters

$margin (float) The margin.

See also

SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins()

at line 3460
SetCellPadding($pad)

Set the same internal Cell padding for top, right, bottom, left-

Parameters

$pad (float) internal padding.

See also

getCellPaddings(), setCellPaddings()

at line 3479
setCellPaddings($left = '', $top = '', $right = '', $bottom = '')

Set the internal Cell paddings.

Parameters

$left (float) left padding
$top (float) top padding
$right (float) right padding
$bottom (float) bottom padding

See also

getCellPaddings(), SetCellPadding()

at line 3501
array getCellPaddings()

Get the internal Cell padding array.

Return Value

array of padding values

See also

setCellPaddings(), SetCellPadding()

at line 3515
setCellMargins($left = '', $top = '', $right = '', $bottom = '')

Set the internal Cell margins.

Parameters

$left (float) left margin
$top (float) top margin
$right (float) right margin
$bottom (float) bottom margin

See also

getCellMargins()

at line 3537
array getCellMargins()

Get the internal Cell margin array.

Return Value

array of margin values

See also

setCellMargins()

at line 3623
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.

Parameters

$auto (boolean) Boolean indicating if mode should be on or off.
$margin (float) Distance from the bottom of the page.

See also

Cell(), MultiCell(), AcceptPageBreak()

at line 3635
boolean getAutoPageBreak()

Return the auto-page-break mode (true or false).

Return Value

boolean auto-page-break mode

at line 3647
SetDisplayMode($zoom, $layout = 'SinglePage', $mode = 'UseNone')

Defines the way the document is to be displayed by the viewer.

Parameters

$zoom (mixed) The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.
  • fullpage: displays the entire page on screen
  • fullwidth: uses maximum width of window
  • real: uses real size (equivalent to 100% zoom)
  • default: uses viewer default mode
$layout (string) The page layout. Possible values are:
  • SinglePage Display one page at a time
  • OneColumn Display the pages in one column
  • TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
  • TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
  • TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left
  • TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right
$mode (string) A name object specifying how the document should be displayed when opened:
  • UseNone Neither document outline nor thumbnail images visible
  • UseOutlines Document outline visible
  • UseThumbs Thumbnail images visible
  • FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible
  • UseOC (PDF 1.5) Optional content group panel visible
  • UseAttachments (PDF 1.6) Attachments panel visible

at line 3724
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.

Parameters

$compress (boolean) Boolean indicating if compression must be enabled.

at line 3738
setSRGBmode($mode = false)

Set flag to force sRGB_IEC61966-2.1 black scaled ICC color profile for the whole document.

Parameters

$mode (boolean) If true force sRGB output intent.

at line 3749
SetDocInfoUnicode($unicode = true)

Turn on/off Unicode mode for document information dictionary (meta tags).

This has effect only when unicode mode is set to false.

Parameters

$unicode (boolean) if true set the meta information in Unicode

at line 3760
SetTitle($title)

Defines the title of the document.

Parameters

$title (string) The title.

See also

SetAuthor(), SetCreator(), SetKeywords(), SetSubject()

at line 3771
SetSubject($subject)

Defines the subject of the document.

Parameters

$subject (string) The subject.

See also

SetAuthor(), SetCreator(), SetKeywords(), SetTitle()

at line 3782
SetAuthor($author)

Defines the author of the document.

Parameters

$author (string) The name of the author.

See also

SetCreator(), SetKeywords(), SetSubject(), SetTitle()

at line 3793
SetKeywords($keywords)

Associates keywords with the document, generally in the form 'keyword1 keyword2 .

..'.

Parameters

$keywords (string) The list of keywords.

See also

SetAuthor(), SetCreator(), SetSubject(), SetTitle()

at line 3804
SetCreator($creator)

Defines the creator of the document. This is typically the name of the application that generates the PDF.

Parameters

$creator (string) The name of the creator.

See also

SetAuthor(), SetKeywords(), SetSubject(), SetTitle()

at line 3815
Error($msg)

This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid.

2004-06-11 :: Nicola Asuni : changed bold tag with strong

Parameters

$msg (string) The error message

at line 3830
Open()

This method begins the generation of the PDF document.

It is not necessary to call it explicitly because AddPage() does it automatically. Note: no page is created by this method

See also

AddPage(), Close()

at line 3842
Close()

Terminates the PDF document.

It is not necessary to call this method explicitly because Output() does it automatically. If the document contains no page, AddPage() is called to prevent from getting an invalid document.

See also

Open(), Output()

at line 3886
setPage($pnum, $resetmargins = false)

Move pointer at the specified document page and update page dimensions.

Parameters

$pnum (int) page number (1 ... numpages)
$resetmargins (boolean) if true reset left, right, top margins and Y position.

See also

getPage(), lastpage(), getNumPages()

at line 3933
lastPage($resetmargins = false)

Reset pointer to the last document page.

Parameters

$resetmargins (boolean) if true reset left, right, top margins and Y position.

See also

setPage(), getPage(), getNumPages()

at line 3944
int getPage()

Get current document page number.

Return Value

int page number

See also

setPage(), lastpage(), getNumPages()

at line 3955
int getNumPages()

Get the total number of insered pages.

Return Value

int number of pages

See also

setPage(), getPage(), lastpage()

at line 3968
addTOCPage($orientation = '', $format = '', $keepmargins = false)

Adds a new TOC (Table Of Content) page to the document.

Parameters

$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

See also

AddPage(), startPage(), endPage(), endTOCPage()

at line 3978
endTOCPage()

Terminate the current TOC (Table Of Content) page

See also

AddPage(), startPage(), endPage(), addTOCPage()

at line 3993
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.

Parameters

$orientation (string) page orientation. Possible values are (case insensitive):
  • P or PORTRAIT (default)
  • L or LANDSCAPE
$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).

See also

startPage(), endPage(), addTOCPage(), endTOCPage(), getPageSizeFromFormat(), setPageFormat()

at line 4017
endPage($tocpage = false)

Terminate the current page

Parameters

$tocpage (boolean) if true set the tocpage state to false (end the page used to display Table Of Content).

See also

AddPage(), startPage(), addTOCPage(), endTOCPage()

at line 4043
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.

Parameters

$orientation (string) page orientation. Possible values are (case insensitive):
  • P or PORTRAIT (default)
  • L or LANDSCAPE
$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.

See also

AddPage(), endPage(), addTOCPage(), endTOCPage(), getPageSizeFromFormat(), setPageFormat()

at line 4114
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.

at line 4148
setHeaderData($ln = '', $lw, $ht = '', $hs = '', $tc = array(0, 0, 0), $lc = array(0, 0, 0))

Set header data.

Parameters

$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.

at line 4163
setFooterData($tc = array(0, 0, 0), $lc = array(0, 0, 0))

Set footer data.

Parameters

$tc (array) RGB array color for text.
$lc (array) RGB array color for line.

at line 4175
array() getHeaderData()

Returns header data:

  • $ret['logo'] = logo image
  • $ret['logo_width'] = width of the image logo in user units
  • $ret['title'] = header title
  • $ret['string'] = header description string

Return Value

array()

at line 4192
setHeaderMargin($hm = 10)

Set header margin.

(minimum distance between header and top page margin)

Parameters

$hm (int) distance in user units

at line 4202
float getHeaderMargin()

Returns header margin in user units.

Return Value

float

at line 4212
setFooterMargin($fm = 10)

Set footer margin.

(minimum distance between footer and bottom page margin)

Parameters

$fm (int) distance in user units

at line 4222
float getFooterMargin()

Returns footer margin in user units.

Return Value

float

at line 4230
setPrintHeader($val = true)

Set a flag to print page header.

Parameters

$val (boolean) set to true to print the page header (default), false otherwise.

at line 4239
setPrintFooter($val = true)

Set a flag to print page footer.

Parameters

$val (boolean) set to true to print the page footer (default), false otherwise.

at line 4248
float getImageRBX()

Return the right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image

Return Value

float

at line 4257
float getImageRBY()

Return the right-bottom (or left-bottom for RTL) corner Y coordinate of last inserted image

Return Value

float

at line 4265
resetHeaderTemplate()

Reset the xobject template used by Header() method.

at line 4274
setHeaderTemplateAutoreset($val = true)

Set a flag to automatically reset the xobject template used by Header() method at each page.

Parameters

$val (boolean) set to true to reset Header xobject template at each page, false otherwise.

at line 4283
Header()

This method is used to render the page header.

It is automatically called by AddPage() and could be overwritten in your own inherited class.

This method is used to render the page footer.

It is automatically called by AddPage() and could be overwritten in your own inherited class.

at line 4568
int PageNo()

Returns the current page number.

Return Value

int page number

See also

getAliasNbPages()

at line 4585
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.

Parameters

$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.

See also

SetDrawSpotColor(), SetFillSpotColor(), SetTextSpotColor()

at line 4599
(array) getSpotColor($name)

Return the Spot color array.

Parameters

$name (string) Name of the spot color.

Return Value

(array) Spot color array or false if not defined.

at line 4621
(string) setSpotColor($type, $name, $tint = 100)

Set the spot color for the specified type ('draw', 'fill', 'text').

Parameters

$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).

Return Value

(string) PDF color command.

at line 4667
SetDrawSpotColor($name, $tint = 100)

Defines the spot color used for all drawing operations (lines, rectangles and cell borders).

Parameters

$name (string) Name of the spot color.
$tint (float) Intensity of the color (from 0 to 100 ; 100 = full intensity by default).

See also

AddSpotColor(), SetFillSpotColor(), SetTextSpotColor()

at line 4679
SetFillSpotColor($name, $tint = 100)

Defines the spot color used for all filling operations (filled rectangles and cell backgrounds).

Parameters

$name (string) Name of the spot color.
$tint (float) Intensity of the color (from 0 to 100 ; 100 = full intensity by default).

See also

AddSpotColor(), SetDrawSpotColor(), SetTextSpotColor()

at line 4691
SetTextSpotColor($name, $tint = 100)

Defines the spot color used for text.

Parameters

$name (string) Name of the spot color.
$tint (int) Intensity of the color (from 0 to 100 ; 100 = full intensity by default).

See also

AddSpotColor(), SetDrawSpotColor(), SetFillSpotColor()

at line 4706
(string) setColorArray($type, $color, $ret = false)

Set the color array for the specified type ('draw', 'fill', 'text').

It can be expressed in RGB, CMYK or GRAY SCALE components. The method can be called before the first page is created and the value is retained from page to page.

Parameters

$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.

Return Value

(string) The PDF command or empty string.

at line 4737
string SetDrawColorArray($color, $ret = false)

Defines the color used for all drawing operations (lines, rectangles and cell borders).

It can be expressed in RGB, CMYK or GRAY SCALE components. The method can be called before the first page is created and the value is retained from page to page.

Parameters

$color (array) Array of colors (1, 3 or 4 values).
$ret (boolean) If true do not send the PDF command.

Return Value

string the PDF command

See also

SetDrawColor()

at line 4751
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.

Parameters

$color (array) Array of colors (1, 3 or 4 values).
$ret (boolean) If true do not send the PDF command.

See also

SetFillColor()

at line 4764
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.

Parameters

$color (array) Array of colors (1, 3 or 4 values).
$ret (boolean) If true do not send the PDF command.

See also

SetFillColor()

at line 4781
(string) setColor($type, $col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '')

Defines the color used by the specified type ('draw', 'fill', 'text').

Parameters

$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)

Return Value

(string) The PDF command or empty string.

at line 4902
string SetDrawColor($col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '')

Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters

$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)

Return Value

string the PDF command

See also

SetDrawColorArray(), SetFillColor(), SetTextColor(), Line(), Rect(), Cell(), MultiCell()

at line 4919
(string) SetFillColor($col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '')

Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters

$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).

Return Value

(string) The PDF command.

See also

SetFillColorArray(), SetDrawColor(), SetTextColor(), Rect(), Cell(), MultiCell()

at line 4936
(string) SetTextColor($col1, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '')

Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.

Parameters

$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).

Return Value

(string) Empty string.

See also

SetTextColorArray(), SetDrawColor(), SetFillColor(), Text(), Cell(), MultiCell()

at line 4952
mixed GetStringWidth($s, $fontname = '', $fontstyle = '', $fontsize, $getarray = false)

Returns the length of a string in user unit. A font must be selected.

Parameters

$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):
  • empty string: regular
  • B: bold
  • I: italic
  • U: underline
  • D: line-trough
  • O: overline
or any combination. The default value is regular.
$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.

Return Value

mixed int total string length or array of characted widths

at line 4968
mixed GetArrStringWidth($sa, $fontname = '', $fontstyle = '', $fontsize, $getarray = false)

Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.

Parameters

$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):
  • empty string: regular
  • B: bold
  • I: italic
  • U: underline
  • D: line trough
  • O: overline
or any combination. The default value is regular.
$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.

Return Value

mixed int total string length or array of characted widths

at line 5005
float GetCharWidth($char, $notlast = true)

Returns the length of the char in user unit for the current font considering current stretching and spacing (tracking).

Parameters

$char (int) The char code whose length is to be returned
$notlast (boolean) If false ignore the font-spacing.

Return Value

float char width

at line 5027
float getRawCharWidth($char)

Returns the length of the char in user unit for the current font.

Parameters

$char (int) The char code whose length is to be returned

Return Value

float char width

at line 5053
int GetNumChars($s)

Returns the numbero of characters in a string.

Parameters

$s (string) The input string.

Return Value

int number of characters

at line 5088
array AddFont($family, $style = '', $fontfile = '', $subset = 'default')

Imports a TrueType, Type1, core, or CID0 font and makes it available.

It is necessary to generate a font definition file first (read /fonts/utils/README.TXT). The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by KPATHFONTS if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.

Parameters

$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):
  • empty string: regular (default)
  • B: bold
  • I: italic
  • BI or IB: bold italic
$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.

Return Value

array containing the font data, or false in case of error.

See also

SetFont(), setFontSubsetting()

at line 5361
SetFont($family, $style = '', $size = null, $fontfile = '', $subset = 'default', $out = true)

Sets the font used to print character strings.

The font can be either a standard one or a font added via the AddFont() method. Standard fonts use Windows encoding cp1252 (Western Europe). The method can be called before the first page is created and the font is retained from page to page. If you just wish to change the current font size, it is simpler to call SetFontSize(). Note: for the standard fonts, the font metric files must be accessible. There are three possibilities for this:

  • They are in the current directory (the one where the running script lies)
  • They are in one of the directories defined by the includepath parameter
  • They are in the directory defined by the KPATH_FONTS constant

Parameters

$family (string) Family font. It can be either a name defined by AddFont() or one of the standard Type1 families (case insensitive):
  • times (Times-Roman)
  • timesb (Times-Bold)
  • timesi (Times-Italic)
  • timesbi (Times-BoldItalic)
  • helvetica (Helvetica)
  • helveticab (Helvetica-Bold)
  • helveticai (Helvetica-Oblique)
  • helveticabi (Helvetica-BoldOblique)
  • courier (Courier)
  • courierb (Courier-Bold)
  • courieri (Courier-Oblique)
  • courierbi (Courier-BoldOblique)
  • symbol (Symbol)
  • zapfdingbats (ZapfDingbats)
It is also possible to pass an empty string. In that case, the current family is retained.
$style (string) Font style. Possible values are (case insensitive):
  • empty string: regular
  • B: bold
  • I: italic
  • U: underline
  • D: line trough
  • O: overline
or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats basic fonts or other fonts when not defined.
$size (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.

See also

AddFont(), SetFontSize()

at line 5385
SetFontSize($size, $out = true)

Defines the size of the current font.

Parameters

$size (float) The font size in points.
$out (boolean) if true output the font size command, otherwise only set the font properties.

See also

SetFont()

at line 5425
array getFontBBox()

Returns the bounding box of the current font in user units.

Return Value

array

at line 5464
float getAbsFontMeasure($s)

Convert a relative font measure into absolute value.

Parameters

$s (int) Font measure.

Return Value

float Absolute measure.

at line 5474
mixed getCharBBox($char)

Returns the glyph bounding box of the specified character in the current font in user units.

Parameters

$char (int) Input character code.

Return Value

mixed array(xMin, yMin, xMax, yMax) or FALSE if not defined.

at line 5491
int getFontDescent($font, $style = '', $size)

Return the font descent value

Parameters

$font (string) font name
$style (string) font style
$size (float) The size (in points)

Return Value

int font descent

at line 5512
int getFontAscent($font, $style = '', $size)

Return the font ascent value.

Parameters

$font (string) font name
$style (string) font style
$size (float) The size (in points)

Return Value

int font ascent

at line 5532
(boolean) isCharDefined($char, $font = '', $style = '')

Return true in the character is present in the specified font.

Parameters

$char (mixed) Character to check (integer value or string)
$font (string) Font name (family name).
$style (string) Font style.

Return Value

(boolean) true if the char is defined, false otherwise.

at line 5559
(string) replaceMissingChars($text, $font = '', $style = '', $subs = array())

Replace missing font characters on selected font with specified substitutions.

Parameters

$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.

Return Value

(string) Processed text.

at line 5596
SetDefaultMonospacedFont($font)

Defines the default monospaced font.

Parameters

$font (string) Font name.

Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document.
The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().

See also

Cell(), Write(), Image(), Link(), SetLink()

Defines the page and position a link points to.

Parameters

$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. This is the default value

See also

AddLink()

Puts a link on a rectangular area of the page.

Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image.

Parameters

$x (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

See also

AddLink(), Annotation(), Cell(), Write(), Image()

at line 5663
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 !!!!

Parameters

$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

at line 5798
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.

Parameters

$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:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
$ln (int) Indicates where the current position should go after the call. Possible values are:
  • 0: to the right (or left for RTL languages)
  • 1: to the beginning of the next line
  • 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
$align (string) Allows to center or align the text. Possible values are:
  • L or empty string: left align (default value)
  • C: center
  • R: right align
  • J: justify
$fill (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:
  • 0 = disabled
  • 1 = horizontal scaling only if text is larger than cell width
  • 2 = forced horizontal scaling to fit cell width
  • 3 = character spacing only if text is larger than cell width
  • 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.
$ignore_min_height (boolean) if true ignore automatic minimum height value.
$calign (string) cell vertical alignment relative to the specified Y value. Possible values are:
  • T : cell top
  • A : font top
  • L : font baseline
  • D : font bottom
  • B : cell bottom
$valign (string) text vertical alignment inside the cell. Possible values are:
  • T : top
  • C : center
  • B : bottom
$rtloff (boolean) if true uses the page top-left corner as origin of axis for $x and $y initial position.

See also

Cell(), Write(), MultiCell(), WriteHTML(), WriteHTMLCell()

at line 5818
boolean AcceptPageBreak()

Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value.

The default implementation returns a value according to the mode selected by SetAutoPageBreak().
This method is called automatically and should not be called directly by the application.

Return Value

boolean

See also

SetAutoPageBreak()

at line 5896
string removeSHY($txt = '')

Removes SHY characters from text.

Unicode Data:

  • Name : SOFT HYPHEN, commonly abbreviated as SHY
  • HTML Entity (decimal): "­"
  • HTML Entity (hex): "­"
  • HTML Entity (named): "­"
  • How to type in Microsoft Windows: [Alt +00AD] or [Alt 0173]
  • UTF-8 (hex): 0xC2 0xAD (c2ad)
  • UTF-8 character: chr(194).chr(173)

Parameters

$txt (string) input string

Return Value

string without SHY characters.

at line 5923
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.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.

Parameters

$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:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
$ln (int) Indicates where the current position should go after the call. Possible values are:
  • 0: to the right (or left for RTL languages)
  • 1: to the beginning of the next line
  • 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
$align (string) Allows to center or align the text. Possible values are:
  • L or empty string: left align (default value)
  • C: center
  • R: right align
  • J: justify
$fill (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:
  • 0 = disabled
  • 1 = horizontal scaling only if text is larger than cell width
  • 2 = forced horizontal scaling to fit cell width
  • 3 = character spacing only if text is larger than cell width
  • 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.
$ignore_min_height (boolean) if true ignore automatic minimum height value.
$calign (string) cell vertical alignment relative to the specified Y value. Possible values are:
  • T : cell top
  • C : center
  • B : cell bottom
  • A : font top
  • L : font baseline
  • D : font bottom
$valign (string) text vertical alignment inside the cell. Possible values are:
  • T : top
  • C : center
  • B : bottom

See also

SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak()

at line 6682
int 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)

This method allows printing text with line breaks.

They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other.
Text can be aligned, centered or justified. The cell block can be framed and the background painted.

Parameters

$w (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:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
$align (string) Allows to center or align the text. Possible values are:
  • L or empty string: left align
  • C: center
  • R: right align
  • J: justification (default value when $ishtml=false)
$fill (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:
  • 0: to the right
  • 1: to the beginning of the next line [DEFAULT]
  • 2: below
$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:
  • 0 = disabled
  • 1 = horizontal scaling only if text is larger than cell width
  • 2 = forced horizontal scaling to fit cell width
  • 3 = character spacing only if text is larger than cell width
  • 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.
$ishtml (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:
  • T: TOP
  • M: middle
  • B: bottom
. This feature works only when $ishtml=false and the cell must fit in a single page.
$fitcell (boolean) if true attempt to fit all the text within the cell by reducing the font size (do not work in HTML mode).

Return Value

int Return the number of cells or 1 for html mode.

See also

SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak()

at line 7094
float getNumLines($txt, $w, $reseth = false, $autopadding = true, $cellpadding = '', $border)

This method return the estimated number of lines for print a simple text string using Multicell() method.

Parameters

$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:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))

Return Value

float Return the minimal height needed for multicell method for printing the $txt param.

at line 7200
float getStringHeight($w, $txt, $reseth = false, $autopadding = true, $cellpadding = '', $border)

This method return the estimated height needed for printing a simple text string using the Multicell() method.

Generally, if you want to know the exact height for a block of content you can use the following alternative technique:

Parameters

$w (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:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))

Return Value

float Return the minimal height needed for multicell method for printing the $txt param.

at line 7237
mixed Write($h, $txt, $link = '', $fill = false, $align = '', $ln = false, $stretch, $firstline = false, $firstblock = false, $maxh, $wadj, $margin = '')

This method prints text from the current position.

Parameters

$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:
  • L or empty string: left align (default value)
  • C: center
  • R: right align
  • J: justify
$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:
  • 0 = disabled
  • 1 = horizontal scaling only if text is larger than cell width
  • 2 = forced horizontal scaling to fit cell width
  • 3 = character spacing only if text is larger than cell width
  • 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.
$firstline (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. The remaining unprinted text will be returned. 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 Value

mixed Return the number of cells or the remaining string if $firstline = true.

at line 7676
Return UTF8ArrSubString($strarr, $start = '', $end = '')

Extract a slice of the $strarr array and return it as string.

Parameters

$strarr (string) The input array of characters.
$start (int) the starting element of $strarr.
$end (int) first element that will not be returned.

Return Value

Return part of a string

at line 7699
Return UniArrSubString($uniarr, $start = '', $end = '')

Extract a slice of the $uniarr array and return it as string.

Parameters

$uniarr (string) The input array of characters.
$start (int) the starting element of $strarr.
$end (int) first element that will not be returned.

Return Value

Return part of a string

at line 7720
Return UTF8ArrayToUniArray($ta)

Convert an array of UTF8 values to array of unicode characters

Parameters

$ta (string) The input array of UTF8 values.

Return Value

Return array of unicode characters

at line 7732
Returns unichr($c)

Returns the unicode caracter specified by UTF-8 value

Parameters

$c (int) UTF-8 value

Return Value

Returns the specified character.

at line 7759
string getImageFileType($imgfile, $iminfo = array())

Return the image type given the file name or array returned by getimagesize() function.

Parameters

$imgfile (string) image file name
$iminfo (array) array of image information returned by getimagesize() function.

Return Value

string image type

at line 7879
image 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())

Puts an image in the page.

The upper-left corner must be given. The dimensions can be specified in different ways:

  • explicit width and height (expressed in user unit)
  • one explicit dimension, the other being calculated automatically in order to keep the original proportions
  • no explicit dimension, in which case the image is put at 72 dpi
Supported formats are JPEG and PNG images whitout GD library and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM; The format can be specified explicitly or inferred from the file extension.
It is possible to put a link on the image.
Remark: if an image is used several times, only one copy will be embedded in the file.

Parameters

$file (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:
  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line
$resize (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:
  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL
$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:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
$fitbox (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.

Return Value

image information

at line 8298
set_mqr($mqr)

Sets the current active configuration setting of magicquotesruntime (if the setmagicquotes_runtime function exist)

Parameters

$mqr (boolean) FALSE for off, TRUE for on.

at line 8313
Returns get_mqr()

Gets the current active configuration setting of magicquotesruntime (if the getmagicquotes_runtime function exist)

Return Value

Returns 0 if magic quotes runtime is off or getmagicquotes_runtime doesn't exist, 1 otherwise.

at line 8717
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.

Parameters

$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

See also

Cell()

at line 8752
float GetX()

Returns the relative X value of current position.

The value is relative to the left border for LTR languages and to the right border for RTL languages.

Return Value

float

See also

SetX(), GetY(), SetY()

at line 8768
float GetAbsX()

Returns the absolute X value of current position.

Return Value

float

See also

SetX(), GetY(), SetY()

at line 8779
float GetY()

Returns the ordinate of the current position.

Return Value

float

See also

SetY(), GetX(), SetX()

at line 8792
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).

Parameters

$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.

See also

GetX(), GetY(), SetY(), SetXY()

at line 8825
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.

Parameters

$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.

See also

GetX(), GetY(), SetY(), SetXY()

at line 8858
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.

Parameters

$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.

See also

SetX(), SetY()

at line 8870
SetAbsX($x)

Set the absolute X coordinate of the current pointer.

Parameters

$x (float) The value of the abscissa in user units.

See also

setAbsX(), setAbsY(), SetAbsXY()

at line 8881
SetAbsY($y)

Set the absolute Y coordinate of the current pointer.

Parameters

$y (float) (float) The value of the ordinate in user units.

See also

setAbsX(), setAbsY(), SetAbsXY()

at line 8893
SetAbsXY($x, $y)

Set the absolute X and Y coordinates of the current pointer.

Parameters

$x (float) The value of the abscissa in user units.
$y (float) (float) The value of the ordinate in user units.

See also

setAbsX(), setAbsY(), SetAbsXY()

at line 8923
Output($name = 'doc.pdf', $dest = 'I')

Send the document to a given destination: string, local file or browser.

In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.
The method first calls Close() if necessary to terminate the document.

Parameters

$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:
  • I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
  • D: send to the browser and force a file download with the name given by name.
  • F: save to a local server file with the name given by name.
  • S: return the document as a string (name is ignored).
  • FI: equivalent to F + I option
  • FD: equivalent to F + D option
  • E: return the document as base64 mime multi-part email attachment (RFC 2045)

See also

Close()

at line 9134
_destroy($destroyall = false, $preserve_objcopy = false)

Unset all class variables except the following critical variables: internal_encoding, state, bufferlen, buffer and diskcache.

Parameters

$destroyall (boolean) if true destroys all class variables, otherwise preserves critical variables.
$preserve_objcopy (boolean) if true preserves the objcopy variable

at line 10307
(string) addTTFfont($fontfile, $fonttype = '', $enc = '', $flags = 32, $outpath = '', $platid = 3, $encid = 1, $addcbbox = false)

Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable).

Parameters

$fontfile (string) Font file (full path).
$fonttype (string) Font type. Leave empty for autodetect mode. Valid values are: TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT = CID-0 Chinese Traditional.
$enc (string) Name of the encoding table to use. Leave empty for default mode. Omit this parameter for TrueType Unicode and symbolic fonts like Symbol or ZapfDingBats.
$flags (int) Unsigned 32-bit integer containing flags specifying various characteristics of the font (PDF32000:2008 - 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for symbol or +32 for non-symbol; +64 for italic. Fixed and Italic mode are generally autodetected so you have to set it to 32 = non-symbolic font (default) or 4 = symbolic font.
$outpath (string) Output path for generated font files (must be writeable by the web server). Leave empty for default font folder.
$platid (int) Platform ID for CMAP table to extract (when building a Unicode font for Windows this value should be 3, for Macintosh should be 1).
$encid (int) Encoding ID for CMAP table to extract (when building a Unicode font for Windows this value should be 1, for Macintosh should be 0). When Platform ID is 3, legal values for Encoding ID are: 0=Symbol, 1=Unicode, 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab, 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4.
$addcbbox (boolean) If true includes the character bounding box information on the php font file.

Return Value

(string) TCPDF font name.

at line 12727
setExtraXMP($xmp)

Set additional XMP data to be added on the default XMP data just before the end of "x:xmpmeta" tag.

IMPORTANT: This data is added as-is without controls, so you have to validate your data before using this method!

Parameters

$xmp (string) Custom XMP data.

at line 13422
setDocCreationTimestamp($time)

Set the document creation timestamp

Parameters

$time (mixed) Document creation timestamp in seconds or date-time string.

at line 13435
setDocModificationTimestamp($time)

Set the document modification timestamp

Parameters

$time (mixed) Document modification timestamp in seconds or date-time string.

at line 13448
(int) getDocCreationTimestamp()

Returns document creation timestamp in seconds.

Return Value

(int) Creation timestamp in seconds.

at line 13458
(int) getDocModificationTimestamp()

Returns document modification timestamp in seconds.

Return Value

(int) Modfication timestamp in seconds.

at line 13469
int getTimestamp($date)

Returns timestamp in seconds from formatted date-time.

Parameters

$date (string) Formatted date-time.

Return Value

int seconds.

at line 13484
string getFormattedDate($time)

Returns a formatted date-time.

Parameters

$time (int) Time in seconds.

Return Value

string escaped date string.

at line 13904
setHeaderFont($font)

Set header font.

Parameters

$font (array) font

at line 13914
array() getHeaderFont()

Get header font.

Return Value

array()

at line 13924
setFooterFont($font)

Set footer font.

Parameters

$font (array) font

at line 13934
array() getFooterFont()

Get Footer font.

Return Value

array()

at line 13944
setLanguageArray($language)

Set language array.

Parameters

$language (array)

at line 13957
getPDFData()

Returns the PDF data.

Output anchor link.

Parameters

$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.

Return Value

the number of cells used or the remaining text if $firstline = true;

at line 14021
array convertHTMLColorToDec($hcolor = '#FFFFFF', $defcol = array('R' => 128, 'G' => 128, 'B' => 128))

Returns an array (RGB or CMYK) from an html color name, or a six-digit (i.e. #3FE5AA), or three-digit (i.e. #7FF) hexadecimal color, or a javascript color array, or javascript color name.

Parameters

$hcolor (string) HTML color.
$defcol (array) Color to return in case of error.

Return Value

array RGB or CMYK color, or false in case of error.

at line 14163
float pixelsToUnits($px)

Converts pixels to User's Units.

Parameters

$px (int) pixels

Return Value

float value in user's unit

See also

setImageScale(), getImageScale()

at line 14174
string unhtmlentities($text_to_convert)

Reverse function for htmlentities.

Convert entities in UTF-8.

Parameters

$text_to_convert (string) Text to convert.

Return Value

string converted text string

at line 14754
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.

Parameters

$permissions (Array) the set of permissions (specify the ones you want to block):
  • print : Print the document;
  • modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble';
  • copy : Copy or otherwise extract text and graphics from the document;
  • annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields);
  • fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified;
  • extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes);
  • assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set;
  • print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
  • owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
$user_pass (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://../tcpdf.crt', 'p' => array('print')))

at line 14913
StartTransform()

Starts a 2D tranformation saving current graphic state.

This function must be called before scaling, mirroring, translation, rotation and skewing. Use StartTransform() before, and StopTransform() after the transformations to restore the normal behavior.

See also

StartTransform(), StopTransform()

at line 14933
StopTransform()

Stops a 2D tranformation restoring previous graphic state.

This function must be called after scaling, mirroring, translation, rotation and skewing. Use StartTransform() before, and StopTransform() after the transformations to restore the normal behavior.

See also

StartTransform(), StopTransform()

at line 14955
ScaleX($s_x, $x = '', $y = '')

Horizontal Scaling.

Parameters

$s_x (float) scaling factor for width 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

See also

StartTransform(), StopTransform()

at line 14968
ScaleY($s_y, $x = '', $y = '')

Vertical Scaling.

Parameters

$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

See also

StartTransform(), StopTransform()

at line 14981
ScaleXY($s, $x = '', $y = '')

Vertical and horizontal proportional Scaling.

Parameters

$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

See also

StartTransform(), StopTransform()

at line 14995
Scale($s_x, $s_y, $x = '', $y = '')

Vertical and horizontal non-proportional Scaling.

Parameters

$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

See also

StartTransform(), StopTransform()

at line 15028
MirrorH($x = '')

Horizontal Mirroring.

Parameters

$x (int) abscissa of the point. Default is current x position

See also

StartTransform(), StopTransform()

at line 15039
MirrorV($y = '')

Verical Mirroring.

Parameters

$y (int) ordinate of the point. Default is current y position

See also

StartTransform(), StopTransform()

at line 15051
MirrorP($x = '', $y = '')

Point reflection mirroring.

Parameters

$x (int) abscissa of the point. Default is current x position
$y (int) ordinate of the point. Default is current y position

See also

StartTransform(), StopTransform()

at line 15064
MirrorL($angle, $x = '', $y = '')

Reflection against a straight line through point (x, y) with the gradient angle (angle).

Parameters

$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

See also

StartTransform(), StopTransform()

at line 15076
TranslateX($t_x)

Translate graphic object horizontally.

Parameters

$t_x (int) movement to the right (or left for RTL)

See also

StartTransform(), StopTransform()

at line 15087
TranslateY($t_y)

Translate graphic object vertically.

Parameters

$t_y (int) movement to the bottom

See also

StartTransform(), StopTransform()

at line 15099
Translate($t_x, $t_y)

Translate graphic object horizontally and vertically.

Parameters

$t_x (int) movement to the right
$t_y (int) movement to the bottom

See also

StartTransform(), StopTransform()

at line 15121
Rotate($angle, $x = '', $y = '')

Rotate object.

Parameters

$angle (float) angle in degrees for counter-clockwise rotation
$x (int) abscissa of the rotation center. Default is current x position
$y (int) ordinate of the rotation center. Default is current y position

See also

StartTransform(), StopTransform()

at line 15151
SkewX($angle_x, $x = '', $y = '')

Skew horizontally.

Parameters

$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

See also

StartTransform(), StopTransform()

at line 15164
SkewY($angle_y, $x = '', $y = '')

Skew vertically.

Parameters

$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

See also

StartTransform(), StopTransform()

at line 15178
Skew($angle_x, $angle_y, $x = '', $y = '')

Skew.

Parameters

$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

See also

StartTransform(), StopTransform()

at line 15238
SetLineWidth($width)

Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.

Parameters

$width (float) The width.

See also

Line(), Rect(), Cell(), MultiCell()

at line 15254
int GetLineWidth()

Returns the current the line width.

Return Value

int Line width

See also

Line(), SetLineWidth()

at line 15281
string SetLineStyle($style, $ret = false)

Set line style.

Parameters

$style (array) Line style. Array with keys among the following:

  • width (float): Width of the line in user units.
  • cap (string): Type of cap to put on the line. Possible values are: butt, round, square. The difference between "square" and "butt" is that "square" projects a flat end past the end of the line.
  • join (string): Type of join. Possible values are: miter, round, bevel.
  • dash (mixed): Dash pattern. Is 0 (without dash) or string with series of length values, which are the lengths of the on and off dashes. For example: "2" represents 2 on, 2 off, 2 on, 2 off, ...; "2,1" is 2 on, 1 off, 2 on, 1 off, ...
  • phase (integer): Modifier on the dash pattern which is used to shift the point at which the pattern starts.
  • color (array): Draw color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName).
$ret (boolean) if true do not send the command.

Return Value

string the PDF command

at line 15428
Line($x1, $y1, $x2, $y2, $style = array())

Draws a line between two points.

Parameters

$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).

See also

SetLineWidth(), SetDrawColor(), SetLineStyle()

at line 15455
Rect($x, $y, $w, $h, $style = '', $border_style = array(), $fill_color = array())

Draws a rectangle.

Parameters

$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:

  • all: Line style of all borders. Array like for SetLineStyle().
  • L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for SetLineStyle().

If a key is not present or is null, not draws the border. 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).

See also

SetLineStyle()

at line 15510
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.

Parameters

$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).

See also

SetLineStyle()

at line 15537
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.

Parameters

$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).

See also

SetLineStyle()

at line 15574
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.

Parameters

$x0
$y0
$rx
$ry
$angle
$astart
$afinish
$style
$line_style
$fill_color
$nc

at line 15740
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.

Parameters

$x0
$y0
$r
$angstr
$angend
$style
$line_style
$fill_color
$nc

at line 15758
PolyLine($p, $style = '', $line_style = array(), $fill_color = array())

Draws a polygonal line

Parameters

$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:

  • all: Line style of all lines. Array like for SetLineStyle().
  • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().

If a key is not present or is null, not draws the line. Default value is default line style (empty array).

$fill_color (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).

at line 15777
Polygon($p, $style = '', $line_style = array(), $fill_color = array(), $closed = true)

Draws a polygon.

Parameters

$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:

  • all: Line style of all lines. Array like for SetLineStyle().
  • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().

If a key is not present or is null, not draws the line. Default value is default line style (empty array).

$fill_color (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

at line 15875
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.

Parameters

$x0
$y0
$r
$ns
$angle
$draw_circle
$style
$line_style
$fill_color
$circle_style
$circle_outLine_style
$circle_fill_color

at line 15923
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

Parameters

$x0
$y0
$r
$nv
$ng
$angle
$draw_circle
$style
$line_style
$fill_color
$circle_style
$circle_outLine_style
$circle_fill_color

at line 15965
RoundedRect($x, $y, $w, $h, $r, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array())

Draws a rounded rectangle.

Parameters

$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).

at line 15984
RoundedRectXY($x, $y, $w, $h, $rx, $ry, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array())

Draws a rounded rectangle.

Parameters

$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).

at line 16051
Arrow($x0, $y0, $x1, $y1, $head_style, $arm_size = 5, $arm_angle = 15)

Draws a grahic arrow.

Parameters

$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

at line 16741
(string) setDestination($name, $y = -1, $page = '', $x = -1)

Add a Named Destination.

NOTE: destination names are unique, so only last entry will be saved.

Parameters

$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) Target page number (leave empty for current page).
$x (float) X position in user units of the destiantion on the selected page (default = -1 = current position;).

Return Value

(string) Stripped named destination identifier or false in case of error.

at line 16778
(array) getDestination()

Return the Named Destination array.

Return Value

(array) Named Destination array.

at line 16812
setBookmark($txt, $level, $y = -1, $page = '', $style = '', $color = array(0, 0, 0))

Adds a bookmark - alias for Bookmark().

Parameters

$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) Target page number (leave empty for current page).
$style (string) Font style: B = Bold, I = Italic, BI = Bold + Italic.
$color (array) RGB color array (values from 0 to 255).

at line 16829
Bookmark($txt, $level, $y = -1, $page = '', $style = '', $color = array(0, 0, 0), $x = -1)

Adds a bookmark.

Parameters

$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) Target page number (leave empty for current page).
$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;).

at line 16987
IncludeJS($script)

Adds a javascript

Parameters

$script (string) Javascript code

at line 17000
int addJavascriptObject($script, $onload = false)

Adds a javascript object and return object ID

Parameters

$script (string) Javascript code
$onload (boolean) if true executes this object when opening the document

Return Value

int internal object ID

at line 17495
setFormDefaultProp($prop = array())

Set default properties for form fields.

Parameters

$prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference.

at line 17506
array getFormDefaultProp()

Return the default properties for form fields.

Return Value

array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference.

at line 17524
TextField($name, $w, $h, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)

Creates a text field

Parameters

$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).

at line 17624
RadioButton($name, $w, $prop = array(), $opt = array(), $onvalue = 'On', $checked = false, $x = '', $y = '', $js = false)

Creates a RadioButton field.

Parameters

$name (string) Field name.
$w (int) Width or 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).

at line 17726
ListBox($name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)

Creates a List-box field

Parameters

$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).

at line 17812
ComboBox($name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)

Creates a Combo-box field

Parameters

$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).

at line 17899
CheckBox($name, $w, $checked = false, $prop = array(), $opt = array(), $onvalue = 'Yes', $x = '', $y = '', $js = false)

Creates a CheckBox field

Parameters

$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).

at line 17979
Button($name, $w, $h, $caption, $action, $prop = array(), $opt = array(), $x = '', $y = '', $js = false)

Creates a button field

Parameters

$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).

at line 18232
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

Parameters

$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.

at line 18268
setSignature($signing_cert = '', $private_key = '', $private_key_password = '', $extracerts = '', $cert_type = 2, $info = array())

Enable document signature (requires the OpenSSL Library).

The digital signature improve document authenticity and integrity and allows o enable extra features on Acrobat Reader. To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12 To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes

Parameters

$signing_cert (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.

at line 18304
setSignatureAppearance($x, $y, $w, $h, $page = -1)

Set the digital signature appearance (a cliccable rectangle area to get signature properties)

Parameters

$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).

at line 18319
addEmptySignatureAppearance($x, $y, $w, $h, $page = -1)

Add an empty digital signature appearance (a cliccable rectangle area to get signature properties)

Parameters

$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).

at line 18358
startPageGroup($page = '')

Create a new page group.

NOTE: call this function before calling AddPage()

Parameters

$page (int) starting group page (leave empty for next page).

at line 18372
AliasNbPages($s = '') deprecated

deprecated deprecated since version 5.9.089 (2011-06-13)

This method is DEPRECATED and doesn't have any effect.

Please remove any reference to this method.

Parameters

$s (string) Empty parameter.

at line 18381
AliasNumPage($s = '') deprecated

deprecated deprecated since version 5.9.089 (2011-06-13)

This method is DEPRECATED and doesn't have any effect.

Please remove any reference to this method.

Parameters

$s (string) Empty parameter.

at line 18389
setStartingPageNumber($num = 1)

Set the starting page number.

Parameters

$num (int) Starting page number.

at line 18400
string getAliasRightShift()

Returns the string alias used right align page numbers.

If the current font is unicode type, the returned string wil contain an additional open curly brace.

Return Value

string

at line 18421
string getAliasNbPages()

Returns the string alias used for the total number of pages.

If the current font is unicode type, the returned string is surrounded by additional curly braces. This alias will be replaced by the total number of pages in the document.

Return Value

string

at line 18436
string getAliasNumPage()

Returns the string alias used for the page number.

If the current font is unicode type, the returned string is surrounded by additional curly braces. This alias will be replaced by the page number.

Return Value

string

at line 18451
alias getPageGroupAlias()

Return the alias for the total number of pages in the current page group.

If the current font is unicode type, the returned string is surrounded by additional curly braces. This alias will be replaced by the total number of pages in this group.

Return Value

alias of the current page group

at line 18466
alias getPageNumGroupAlias()

Return the alias for the page number on the current page group.

If the current font is unicode type, the returned string is surrounded by additional curly braces. This alias will be replaced by the page number (relative to the belonging group).

Return Value

alias of the current page group

at line 18479
current getGroupPageNo()

Return the current page in the group.

Return Value

current page in the group

at line 18489
getGroupPageNoFormatted()

Returns the current group page number formatted as a string.

See also

PaneNo(), formatPageNumber()

at line 18522
PageNoFormatted()

Returns the current page number formatted as a string.

See also

PaneNo(), formatPageNumber()

at line 18556
startLayer($name = '', $print = true, $view = true)

Start a new pdf layer.

Parameters

$name (string) Layer name (only a-z letters and numbers). Leave empty for automatic name.
$print (boolean) Set to true to print this layer.
$view (boolean) Set to true to view this layer.

at line 18573
endLayer()

End the current PDF layer.

at line 18589
setVisibility($v)

Set the visibility of the successive elements.

This can be useful, for instance, to put a background image or color that will show on screen but won't print.

Parameters

$v (string) visibility mode. Legal values are: all, print, screen or view.

at line 18692
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).

Parameters

$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).

at line 18715
array. getOverprint()

Get the overprint mode array (OP, op, OPM).

(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).

Return Value

array.

at line 18728
setAlpha($stroking = 1, $bm = 'Normal', $nonstroking = '', $ais = false)

Set alpha for stroking (CA) and non-stroking (ca) operations.

Parameters

$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)

at line 18760
array. getAlpha()

Get the alpha mode array (CA, ca, BM, AIS).

(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).

Return Value

array.

at line 18770
setJPEGQuality($quality)

Set the default JPEG compression quality (1-100)

Parameters

$quality (int) JPEG quality, integer between 1 and 100

at line 18783
setDefaultTableColumns($cols = 4)

Set the default number of columns in a row for HTML tables.

Parameters

$cols (int) number of columns

at line 18793
setCellHeightRatio($h)

Set the height of the cell (line height) respect the font height.

Parameters

$h (int) cell proportion respect font height (typical value = 1.25).

at line 18802
getCellHeightRatio()

return the height of cell repect font height.

at line 18812
setPDFVersion($version = '1.7')

Set the PDF version (check PDF reference for valid values).

Parameters

$version (string) PDF document version.

at line 18830
setViewerPreferences($preferences)

Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.

(see Section 8.1 of PDF reference, "Viewer Preferences").

  • HideToolbar boolean (Optional) A flag specifying whether to hide the viewer application's tool bars when the document is active. Default value: false.
  • HideMenubar boolean (Optional) A flag specifying whether to hide the viewer application's menu bar when the document is active. Default value: false.
  • HideWindowUI boolean (Optional) A flag specifying whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed. Default value: false.
  • FitWindow boolean (Optional) A flag specifying whether to resize the document's window to fit the size of the first displayed page. Default value: false.
  • CenterWindow boolean (Optional) A flag specifying whether to position the document's window in the center of the screen. Default value: false.
  • DisplayDocTitle boolean (Optional; PDF 1.4) A flag specifying whether the window's title bar should display the document title taken from the Title entry of the document information dictionary (see Section 10.2.1, "Document Information Dictionary"). If false, the title bar should instead display the name of the PDF file containing the document. Default value: false.
  • NonFullScreenPageMode name (Optional) The document's page mode, specifying how to display the document on exiting full-screen mode:
    • UseNone Neither document outline nor thumbnail images visible
    • UseOutlines Document outline visible
    • UseThumbs Thumbnail images visible
    • UseOC Optional content group panel visible
    This entry is meaningful only if the value of the PageMode entry in the catalog dictionary (see Section 3.6.1, "Document Catalog") is FullScreen; it is ignored otherwise. Default value: UseNone.
  • ViewArea name (Optional; PDF 1.4) The name of the page boundary representing the area of a page to be displayed when viewing the document on the screen. Valid values are (see Section 10.10.1, "Page Boundaries").:
    • MediaBox
    • CropBox (default)
    • BleedBox
    • TrimBox
    • ArtBox
  • ViewClip name (Optional; PDF 1.4) The name of the page boundary to which the contents of a page are to be clipped when viewing the document on the screen. Valid values are (see Section 10.10.1, "Page Boundaries").:
    • MediaBox
    • CropBox (default)
    • BleedBox
    • TrimBox
    • ArtBox
  • PrintArea name (Optional; PDF 1.4) The name of the page boundary representing the area of a page to be rendered when printing the document. Valid values are (see Section 10.10.1, "Page Boundaries").:
    • MediaBox
    • CropBox (default)
    • BleedBox
    • TrimBox
    • ArtBox
  • PrintClip name (Optional; PDF 1.4) The name of the page boundary to which the contents of a page are to be clipped when printing the document. Valid values are (see Section 10.10.1, "Page Boundaries").:
    • MediaBox
    • CropBox (default)
    • BleedBox
    • TrimBox
    • ArtBox
  • PrintScaling name (Optional; PDF 1.6) The page scaling option to be selected when a print dialog is displayed for this document. Valid values are:
    • None, which indicates that the print dialog should reflect no page scaling
    • AppDefault (default), which indicates that applications should use the current print scaling
  • Duplex name (Optional; PDF 1.7) The paper handling option to use when printing the file from the print dialog. The following values are valid:
    • Simplex - Print single-sided
    • DuplexFlipShortEdge - Duplex and flip on the short edge of the sheet
    • DuplexFlipLongEdge - Duplex and flip on the long edge of the sheet
    Default value: none
  • PickTrayByPDFSize boolean (Optional; PDF 1.7) A flag specifying whether the PDF page size is used to select the input paper tray. This setting influences only the preset values used to populate the print dialog presented by a PDF viewer application. If PickTrayByPDFSize is true, the check box in the print dialog associated with input paper tray is checked. Note: This setting has no effect on Mac OS systems, which do not provide the ability to pick the input tray by size.
  • PrintPageRange array (Optional; PDF 1.7) The page numbers used to initialize the print dialog box when the file is printed. The first page of the PDF file is denoted by 1. Each pair consists of the first and last pages in the sub-range. An odd number of integers causes this entry to be ignored. Negative numbers cause the entire array to be ignored. Default value: as defined by PDF viewer application
  • NumCopies integer (Optional; PDF 1.7) The number of copies to be printed when the print dialog is opened for this file. Supported values are the integers 2 through 5. Values outside this range are ignored. Default value: as defined by PDF viewer application, but typically 1

Parameters

$preferences (array) array of options.

at line 18847
colorRegistrationBar($x, $y, $w, $h, $transition = true, $vertical = false, $colors = 'A,R,G,B,C,M,Y,K')

Paints color transition registration bars

Parameters

$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, one letter per color separated by comma (for example 'A,W,R,G,B,C,M,Y,K'): A=black, W=white, R=red, G=green, B=blue, C=cyan, M=magenta, Y=yellow, K=black.

at line 18945
cropMark($x, $y, $w, $h, $type = 'T,R,B,L', $color = array(0, 0, 0))

Paints crop marks.

Parameters

$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 black).

at line 19016
registrationMark($x, $y, $r, $double = false, $cola = array(0, 0, 0), $colb = array(255, 255, 255))

Paints a registration mark

Parameters

$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 black).
$colb (array) second crop mark color.

at line 19047
LinearGradient($x, $y, $w, $h, $col1 = array(), $col2 = array(), $coords = array(0, 0, 1, 0))

Paints a linear colour gradient.

Parameters

$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 lineargradientcoords.jpg). The default value is from left to right (x1=0, y1=0, x2=1, y2=0).

at line 19065
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.

Parameters

$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 radialgradientcoords.jpg). (fx, fy) should be inside the circle, otherwise some areas will not be defined.

at line 19088
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.

Parameters

$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)
  • for one patch mesh: array(float x1, float y1, .... float x12, float y12): 12 pairs of coordinates (normally from 0 to 1) which specify the Bezier control points that define the patch. First pair is the lower left edge point, next is its right control point (control point 2). Then the other points are defined in the order: control point 1, edge point, control point 2 going counter-clockwise around the patch. Last (x12, y12) is the first edge point's left control point (control point 1).
  • for two or more patch meshes: array[number of patches]: arrays with the following keys for each patch: f: where to put that patch (0 = first patch, 1, 2, 3 = right, top and left of precedent patch - I didn't figure this out completely - just try and error ;-) points: 12 pairs of coordinates of the Bezier control points as above for the first patch, 8 pairs of coordinates for the following patches, ignoring the coordinates already defined by the precedent patch (I also didn't figure out the order of these - also: try and see what's happening) colors: must be 4 colors for the first patch, 2 colors for the following patches
$coords_min (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.

at line 19204
Gradient($type, $coords, $stops, $background = array(), $antialias = false)

Output gradient.

Parameters

$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.

at line 19309
_putshaders()

Output gradient shaders.

at line 19501
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.

Parameters

$xc
$yc
$r
$a
$b
$style
$cw
$o

at line 19522
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.

Parameters

$xc
$yc
$rx
$ry
$a
$b
$style
$cw
$o
$nc

at line 19563
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).

Parameters

$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:
  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line
$palign (string) Allows to center or align the image on the current line. Possible values are:
  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL
$border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
$fitonpage (boolean) if true the image is resized to not exceed page dimensions.
$fixoutvals (boolean) if true remove values outside the bounding box.

at line 19879
setBarcode($bc = '')

Set document barcode.

Parameters

$bc (string) barcode

at line 19889
string getBarcode()

Get current barcode.

Return Value

string

at line 19923
write1DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $xres = '', $style = '', $align = '')

Print a Linear Barcode.

Parameters

$code (string) code to print
$type (string) type of barcode (see barcodes.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:
  • boolean $style['border'] if true prints a border
  • int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)
  • int $style['hpadding'] horizontal padding in user units (set to 'auto' for automatic padding)
  • int $style['vpadding'] vertical padding in user units (set to 'auto' for automatic padding)
  • array $style['fgcolor'] color array for bars and text
  • mixed $style['bgcolor'] color array for background (set to false for transparent)
  • boolean $style['text'] if true prints text below the barcode
  • string $style['label'] override default label
  • string $style['font'] font name for text
  • int $style['fontsize'] font size for text
  • int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing.
  • string $style['position'] horizontal position of the containing barcode cell on the page: L = left margin; C = center; R = right margin.
  • string $style['align'] horizontal position of the barcode on the containing rectangle: L = left; C = center; R = right.
  • string $style['stretch'] if true stretch the barcode to best fit the available width, otherwise uses $xres resolution for a single bar.
  • string $style['fitwidth'] if true reduce the width to fit the barcode width + padding. When this option is enabled the 'stretch' option is automatically disabled.
  • string $style['cellfitalign'] this option works only when 'fitwidth' is true and 'position' is unset or empty. Set the horizontal position of the containing barcode cell inside the specified rectangle: L = left; C = center; R = right.
$align (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

at line 20229
writeBarcode($x, $y, $w, $h, $type, $style, $font, $xres, $code) deprecated

deprecated deprecated since version 3.1.000 (2008-06-10)

This function is DEPRECATED, please use the new write1DBarcode() function.

Parameters

$x (int) x position in user units
$y (int) y position in user units
$w (int) width in user units
$h (int) height position in user units
$type (string) type of barcode
$style (string) barcode style
$font (string) font for text
$xres (int) x resolution
$code (string) code to print

See also

write1DBarcode()

at line 20294
write2DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $style = '', $align = '', $distort = false)

Print 2D Barcode.

Parameters

$code (string) code to print
$type (string) type of barcode (see 2dbarcodes.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:
  • boolean $style['border'] if true prints a border around the barcode
  • int $style['padding'] padding to leave around the barcode in barcode units (set to 'auto' for automatic padding)
  • int $style['hpadding'] horizontal padding in barcode units (set to 'auto' for automatic padding)
  • int $style['vpadding'] vertical padding in barcode units (set to 'auto' for automatic padding)
  • int $style['modulewidth'] width of a single module in points
  • int $style['moduleheight'] height of a single module in points
  • array $style['fgcolor'] color array for bars and text
  • mixed $style['bgcolor'] color array for background or false for transparent
  • string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch
  • $style['modulewidth'] width of a single module in points
  • $style['moduleheight'] height of a single module in points
$align (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line
$distort (boolean) if true distort the barcode to fit width and height, otherwise preserve aspect ratio

at line 20520
array getMargins()

Returns an array containing current margins:

  • $ret['left'] = left margin
  • $ret['right'] = right margin
  • $ret['top'] = top margin
  • $ret['bottom'] = bottom margin
  • $ret['header'] = header margin
  • $ret['footer'] = footer margin
  • $ret['cell'] = cell padding array
  • $ret['padding_left'] = cell left padding
  • $ret['padding_top'] = cell top padding
  • $ret['padding_right'] = cell right padding
  • $ret['padding_bottom'] = cell bottom padding

Return Value

array containing all margins measures

at line 20547
array getOriginalMargins()

Returns an array containing original margins:

  • $ret['left'] = left margin
  • $ret['right'] = right margin

Return Value

array containing all margins measures

at line 20561
current getFontSize()

Returns the current font size.

Return Value

current font size

at line 20571
current getFontSizePt()

Returns the current font size in points unit.

Return Value

current font size in points unit

at line 20581
string getFontFamily()

Returns the current font family name.

Return Value

string current font family name

at line 20591
string getFontStyle()

Returns the current font style.

Return Value

string current font style

at line 20607
string fixHTMLCode($html, $default_css = '', $tagvs = '', $tidy_options = '')

Cleanup HTML code (requires HTML Tidy library).

Parameters

$html (string) htmlcode to fix
$default_css (string) CSS commands to add
$tagvs (array) parameters for setHtmlVSpace method
$tidy_options (array) options for tidyparsestring function

Return Value

string XHTML code cleaned up

See also

setHtmlVSpace()

at line 21107
array getCSSPadding($csspadding, $width)

Get the internal Cell padding from CSS attribute.

Parameters

$csspadding (string) padding properties
$width (float) width of the containing element

Return Value

array of cell paddings

at line 21161
array getCSSMargin($cssmargin, $width)

Get the internal Cell margin from CSS attribute.

Parameters

$cssmargin (string) margin properties
$width (float) width of the containing element

Return Value

array of cell margins

at line 21215
array getCSSBorderMargin($cssbspace, $width)

Get the border-spacing from CSS attribute.

Parameters

$cssbspace (string) border-spacing CSS properties
$width (float) width of the containing element

Return Value

array of border spacings

at line 22162
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.

Parameters

$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:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
$ln (int) Indicates where the current position should go after the call. Possible values are:
  • 0: to the right (or left for RTL language)
  • 1: to the beginning of the next line
  • 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
$fill (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:
  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL
$autopadding (boolean) if true, uses internal padding and automatically adjust it to account for line width.

See also

Multicell(), writeHTML()

at line 22178
writeHTML($html, $ln = true, $fill = false, $reseth = false, $cell = false, $align = '')

Allows to preserve some HTML formatting (limited support).
IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting.

Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul

Parameters

$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:
  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

at line 25148
setLIsymbol($symbol = '!')

Set the default bullet to be used as LI bullet symbol

Parameters

$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')

at line 25192
SetBooklet($booklet = true, $inner = -1, $outer = -1)

Set the booklet mode for double-sided pages.

Parameters

$booklet (boolean) true set the booklet mode on, false otherwise.
$inner (float) Inner page margin.
$outer (float) Outer page margin.

at line 25232
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.

Parameters

$tagvs (array) array of tags and relative vertical spaces.

at line 25242
setListIndentWidth($width)

Set custom width for list indentation.

Parameters

$width (float) width of the indentation. Use negative value to disable it.

at line 25252
setOpenCell($isopen)

Set the top/bottom cell sides to be open or closed when the cell cross the page.

Parameters

$isopen (boolean) if true keeps the top/bottom border open for the cell sides that cross the page.

at line 25263
setHtmlLinksStyle($color = array(0, 0, 255), $fontstyle = 'U')

Set the color and font style for HTML links.

Parameters

$color (array) RGB array of colors
$fontstyle (string) additional font styles to add

at line 25278
float getHTMLUnitToUnits($htmlval, $refsize = 1, $defaultunit = 'px', $points = false)

Convert HTML string containing value and unit of measure to user's units or points.

Parameters

$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

Return Value

float value in user's unit or point if $points=true

at line 25357
string intToRoman($number)

Returns the Roman representation of an integer number

Parameters

$number (int) number to convert

Return Value

string roman representation of the specified number

at line 26013
true movePage($frompage, $topage)

Move a page to a previous position.

Parameters

$frompage (int) number of the source page
$topage (int) number of the destination page (must be less than $frompage)

Return Value

true in case of success, false in case of error.

at line 26176
true deletePage($page)

Remove the specified page.

Parameters

$page (int) page to remove

Return Value

true in case of success, false in case of error.

at line 26356
true copyPage($page)

Clone the specified page to a new page.

Parameters

$page (int) number of page to copy (0 = current page)

Return Value

true in case of success, false in case of error.

at line 26433
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.

Parameters

$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).

See also

addTOCPage(), endTOCPage(), addHTMLTOC()

at line 26638
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.

Parameters

$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: "#TOCDESCRIPTION#" for bookmark title, "#TOCPAGE_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).

See also

addTOCPage(), endTOCPage(), addTOC()

at line 26771
startTransaction()

Stores a copy of the current TCPDF object used for undo operation.

at line 26788
commitTransaction()

Delete the copy of the current TCPDF object used for undo operation.

at line 26802
TCPDF rollbackTransaction($self = false)

This method allows to undo the latest transaction by returning the latest saved TCPDF object with startTransaction().

Parameters

$self (boolean) if true restores current class object to previous state without the need of reassignment via the returned value.

Return Value

TCPDF object.

at line 26831
cloned objclone($object)

Creates a copy of a class object

Parameters

$object (object) class object to be cloned

Return Value

cloned object

at line 26842
boolean empty_string($str)

Determine whether a string is empty.

Parameters

$str (string) string to be checked

Return Value

boolean true if string is empty

at line 26855
Returns revstrpos($haystack, $needle, $offset)

Find position of last occurrence of a substring in a string

Parameters

$haystack (string) The string to search in.
$needle (string) substring to search.
$offset (int) May be specified to begin searching an arbitrary number of characters into the string.

Return Value

Returns the position where the needle exists. Returns FALSE if the needle was not found.

at line 26872
setEqualColumns($numcols, $width, $y = '')

Set multiple columns of the same size

Parameters

$numcols (int) number of columns (set to zero to disable columns mode)
$width (int) column width
$y (int) column starting Y position (leave empty for current Y position)

at line 26904
resetColumns()

Remove columns and reset page margins.

at line 26917
setColumnsArray($columns)

Set columns array.

Each column is represented by an array of arrays with the following keys: (w = width, s = space between columns, y = column top position).

Parameters

$columns (array)

at line 26931
selectColumn($col = '')

Set position at a given column

Parameters

$col (int) column number (from 0 to getNumberOfColumns()-1); empty string = current column.

at line 27010
int getColumn()

Return the current column number

Return Value

int current column number

at line 27020
int getNumberOfColumns()

Return the current number of columns.

Return Value

int number of columns

at line 27031
sting serializeTCPDFtagParameters($pararray)

Serialize an array of parameters to be used with TCPDF tag in HTML code.

Parameters

$pararray (array) parameters array

Return Value

sting containing serialized data

at line 27043
setTextRenderingMode($stroke, $fill = true, $clip = false)

Set Text rendering mode.

Parameters

$stroke (int) outline size in user units (0 = disable).
$fill (boolean) if true fills the text (default).
$clip (boolean) if true activate clipping mode

at line 27098
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.

Parameters

$params (array) Array of parameters: enabled (boolean) set to true to enable shadow; depthw (float) shadow width in user units; depthh (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.

at line 27140
Array getTextShadow()

Return the text shadow parameters array.

Return Value

Array of parameters.

at line 27228
array getHyphenPatternsFromTEX($file)

Returns an array of hyphenation patterns.

Parameters

$file (string) TEX file containing hypenation patterns. TEX pattrns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/

Return Value

array of hyphenation patterns

at line 27267
array hyphenateText($text, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8)

Returns text with soft hyphens.

Parameters

$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 algoritm.
$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 algoritm.
$charmax (int) Maximum length of broken piece of word.

Return Value

array text with soft hyphens

at line 27313
setRasterizeVectorImages($mode)

Enable/disable rasterization of vector images using ImageMagick library.

Parameters

$mode (boolean) if true enable rasterization, false otherwise.

at line 27415
setFontSubsetting($enable = true)

Enable or disable default option for font subsetting.

Parameters

$enable (boolean) if true enable font subsetting by default.

at line 27430
boolean getFontSubsetting()

Return the default option for font subsetting.

Return Value

boolean default font subsetting state.

at line 27443
left stringLeftTrim($str, $replace = '')

Left trim the input string

Parameters

$str (string) string to trim
$replace (string) string that replace spaces.

Return Value

left trimmed string

at line 27456
right stringRightTrim($str, $replace = '')

Right trim the input string

Parameters

$str (string) string to trim
$replace (string) string that replace spaces.

Return Value

right trimmed string

at line 27469
trimmed stringTrim($str, $replace = '')

Trim the input string

Parameters

$str (string) string to trim
$replace (string) string that replace spaces.

Return Value

trimmed string

at line 27482
true isUnicodeFont()

Return true if the current font is unicode type.

Return Value

true for unicode font, false otherwise.

at line 27494
string getFontFamilyName($fontfamily)

Return normalized font name

Parameters

$fontfamily (string) property string containing font family names

Return Value

string normalized font name

at line 27537
int startTemplate($w, $h, $group = false)

Start a new XObject Template.

An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images). An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked. Note: X,Y coordinates will be reset to 0,0.

Parameters

$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).

Return Value

int the XObject Template ID in case of success or false in case of error.

See also

endTemplate(), printTemplate()

at line 27602
int endTemplate()

End the current XObject Template started with startTemplate() and restore the previous graphic state.

An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images). An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked.

Return Value

int the XObject Template ID in case of success or false in case of error.

See also

startTemplate(), printTemplate()

at line 27631
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.

Parameters

$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:
  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line
$palign (string) Allows to center or align the template on the current line. Possible values are:
  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL
$fitonpage (boolean) If true the template is resized to not exceed page dimensions.

See also

startTemplate(), endTemplate()

at line 27755
setFontStretching($perc = 100)

Set the percentage of character stretching.

Parameters

$perc (int) percentage of stretching (100 = no stretching)

at line 27766
float getFontStretching()

Get the percentage of character stretching.

Return Value

float stretching value

at line 27777
setFontSpacing($spacing)

Set the amount to increase or decrease the space between characters in a text.

Parameters

$spacing (float) amount to increase or decrease the space between characters in a text (0 = default spacing)

at line 27788
int getFontSpacing()

Get the amount to increase or decrease the space between characters in a text.

Return Value

int font spacing (tracking) value

at line 27800
array getPageRegions()

Return an array of no-write page regions

Return Value

array of no-write page regions

See also

setPageRegions(), addPageRegion()

at line 27815
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.

Parameters

$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.

See also

addPageRegion(), getPageRegions()

at line 27835
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.

Parameters

$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).

See also

setPageRegions(), getPageRegions()

at line 27854
removePageRegion($key)

Remove a single no-write region.

Parameters

$key (int) region key

See also

setPageRegions(), getPageRegions()

at line 27975
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.

Parameters

$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:
  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line
If the alignment is an empty string, then the pointer will be restored on the starting SVG position.
$palign (string) Allows to center or align the image on the current line. Possible values are:
  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL
$border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
$fitonpage (boolean) if true the image is resized to not exceed page dimensions.