class TCPDF_IMPORT extends TCPDF (View source)

Properties

protected $page

Current page number.

from  TCPDF
protected $n

Current object number.

from  TCPDF
protected $offsets

Array of object offsets.

from  TCPDF
protected $pageobjects

Array of object IDs for each page.

from  TCPDF
protected $buffer

Buffer holding in-memory PDF.

from  TCPDF
protected $pages

Array containing pages.

from  TCPDF
protected $state

Current document state.

from  TCPDF
protected $compress

Compression flag.

from  TCPDF
protected $CurOrientation

Current page orientation (P = Portrait, L = Landscape).

from  TCPDF
protected $pagedim

Page dimensions.

from  TCPDF
protected $k

Scale factor (number of points in user unit).

from  TCPDF
protected $fwPt

Width of page format in points.

from  TCPDF
protected $fhPt

Height of page format in points.

from  TCPDF
protected $wPt

Current width of page in points.

from  TCPDF
protected $hPt

Current height of page in points.

from  TCPDF
protected $w

Current width of page in user unit.

from  TCPDF
protected $h

Current height of page in user unit.

from  TCPDF
protected $lMargin

Left margin.

from  TCPDF
protected $rMargin

Right margin.

from  TCPDF
protected $clMargin

Cell left margin (used by regions).

from  TCPDF
protected $crMargin

Cell right margin (used by regions).

from  TCPDF
protected $tMargin

Top margin.

from  TCPDF
protected $bMargin

Page break margin.

from  TCPDF
protected Since: 5.9.000 (2010-10-03)
$cell_padding

Array of cell internal paddings ('T' => top, 'R' => right, 'B' => bottom, 'L' => left).

from  TCPDF
protected Since: 5.9.000 (2010-10-04)
$cell_margin

Array of cell margins ('T' => top, 'R' => right, 'B' => bottom, 'L' => left).

from  TCPDF
protected $x

Current horizontal position in user unit for cell positioning.

from  TCPDF
protected $y

Current vertical position in user unit for cell positioning.

from  TCPDF
protected $lasth

Height of last cell printed.

from  TCPDF
protected $LineWidth

Line width in user unit.

from  TCPDF
protected $CoreFonts

Array of standard font names.

from  TCPDF
protected $fonts

Array of used fonts.

from  TCPDF
protected $FontFiles

Array of font files.

from  TCPDF
protected $diffs

Array of encoding differences.

from  TCPDF
protected $images

Array of used images.

from  TCPDF
protected $svg_tag_depth

Depth of the svg tag, to keep track if the svg tag is a subtag or the root tag.

from  TCPDF
protected $PageAnnots

Array of Annotations in pages.

from  TCPDF
$links

Array of internal links.

from  TCPDF
protected $FontFamily

Current font family.

from  TCPDF
protected $FontStyle

Current font style.

from  TCPDF
protected Since: 2.8.000 (2007-03-29)
$FontAscent

Current font ascent (distance between font top and baseline).

from  TCPDF
protected Since: 2.8.000 (2007-03-29)
$FontDescent

Current font descent (distance between font bottom and baseline).

from  TCPDF
protected $underline

Underlining flag.

from  TCPDF
protected $overline

Overlining flag.

from  TCPDF
protected $CurrentFont

Current font info.

from  TCPDF
protected $FontSizePt

Current font size in points.

from  TCPDF
protected $FontSize

Current font size in user unit.

from  TCPDF
protected $DrawColor

Commands for drawing color.

from  TCPDF
protected $FillColor

Commands for filling color.

from  TCPDF
protected $TextColor

Commands for text color.

from  TCPDF
protected $ColorFlag

Indicates whether fill and text colors are different.

from  TCPDF
protected $AutoPageBreak

Automatic page breaking.

from  TCPDF
protected $PageBreakTrigger

Threshold used to trigger page breaks.

from  TCPDF
protected $InHeader

Flag set when processing page header.

from  TCPDF
protected $InFooter

Flag set when processing page footer.

from  TCPDF
protected $ZoomMode

Zoom display mode.

from  TCPDF
protected $LayoutMode

Layout display mode.

from  TCPDF
protected $docinfounicode

If true set the document information dictionary in Unicode.

from  TCPDF
protected $title

Document title.

from  TCPDF
protected $subject

Document subject.

from  TCPDF
protected $author

Document author.

from  TCPDF
protected $keywords

Document keywords.

from  TCPDF
protected $creator

Document creator.

from  TCPDF
protected $starting_page_number

Starting page number.

from  TCPDF
protected Since: 2002-07-31
$img_rb_x

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

from  TCPDF
protected Since: 2002-07-31
$img_rb_y

The right-bottom corner Y coordinate of last inserted image.

from  TCPDF
protected Since: 2004-06-14
$imgscale

Adjusting factor to convert pixels to user units.

from  TCPDF
protected Since: 2005-01-02
$isunicode

Boolean flag set to true when the input text is unicode (require unicode fonts).

from  TCPDF
protected Since: 1.5.3
$PDFVersion

PDF version.

from  TCPDF
protected $header_xobjid

ID of the stored default header template (-1 = not set).

from  TCPDF
protected $header_xobj_autoreset

If true reset the Header Xobject template at each page

from  TCPDF
protected float $header_margin

Minimum distance between header and top page margin.

from  TCPDF
$footer_margin

Minimum distance between footer and bottom page margin.

from  TCPDF
protected Since: 1.53.0.TC013
$original_lMargin

Original left margin value.

from  TCPDF
protected Since: 1.53.0.TC013
$original_rMargin

Original right margin value.

from  TCPDF
protected array<int,string|float|null> $header_font

Default font used on page header.

from  TCPDF
$footer_font

Default font used on page footer.

from  TCPDF
protected $l

Language templates.

from  TCPDF
protected $barcode

Barcode to print on page footer (only if set).

from  TCPDF
protected $print_header

Boolean flag to print/hide page header.

from  TCPDF
$print_footer

Boolean flag to print/hide page footer.

from  TCPDF
$header_logo

Header image logo.

from  TCPDF
protected $header_logo_width

Width of header image logo in user units.

from  TCPDF
protected $header_title

Title to be printed on default page header.

from  TCPDF
protected $header_string

String to print on page header after title.

from  TCPDF
protected int[] Since: 5.9.174 (2012-07-25)
$header_text_color

Color for header text (RGB array).

from  TCPDF
protected int[] Since: 5.9.174 (2012-07-25)
$header_line_color

Color for header line (RGB array).

from  TCPDF
$footer_text_color

Color for footer text (RGB array).

from  TCPDF
$footer_line_color

Color for footer line (RGB array).

from  TCPDF
protected Since: 5.9.174 (2012-07-25)
$txtshadow

Text shadow data array.

from  TCPDF
protected $default_table_columns

Default number of columns for html table.

from  TCPDF
protected $HREF

HTML PARSER: array to store current link and rendering styles.

from  TCPDF
protected $fontlist

List of available fonts on filesystem.

from  TCPDF
protected $fgcolor

Current foreground color.

from  TCPDF
protected $listordered

HTML PARSER: array of boolean values, true in case of ordered list (OL), false otherwise.

from  TCPDF
protected $listcount

HTML PARSER: array count list items on nested lists.

from  TCPDF
protected $listnum

HTML PARSER: current list nesting level.

from  TCPDF
protected $listindent

HTML PARSER: indent amount for lists.

from  TCPDF
protected $listindentlevel

HTML PARSER: current list indententation level.

from  TCPDF
protected $bgcolor

Current background color.

from  TCPDF
protected $tempfontsize

Temporary font size in points.

from  TCPDF
protected $lispacer

Spacer string for LI tags.

from  TCPDF
protected Since: 1.53.0.TC010
$encoding

Default encoding.

from  TCPDF
protected Since: 2.0.000
$rtl

Boolean flag to indicate if the document language is Right-To-Left.

from  TCPDF
protected Since: 2.0.000
$tmprtl

Boolean flag used to force RTL or LTR string direction.

from  TCPDF
protected Since: 2.0.000 (2008-01-02)
$encrypted

IBoolean flag indicating whether document is protected.

from  TCPDF
protected Since: 5.0.005 (2010-05-11)
$encryptdata

Array containing encryption settings.

from  TCPDF
protected Since: 2.0.000 (2008-01-02)
$last_enc_key

Last RC4 key encrypted (cached for optimisation).

from  TCPDF
protected Since: 2.0.000 (2008-01-02)
$last_enc_key_c

Last RC4 computed key.

from  TCPDF
protected Since: 5.0.005 (2010-05-12)
$file_id

File ID (used on document trailer).

from  TCPDF
protected Since: 6.7.5 (2024-03-21)
$hash_key

Internal secret used to encrypt data.

from  TCPDF
protected Since: 2.1.002 (2008-02-12)
$outlines

Outlines for bookmark.

from  TCPDF
protected Since: 2.1.002 (2008-02-12)
$OutlineRoot

Outline root for bookmark.

from  TCPDF
protected Since: 2.1.002 (2008-02-12)
$javascript

Javascript code.

from  TCPDF
protected Since: 2.1.002 (2008-02-12)
$n_js

Javascript counter.

from  TCPDF
protected Since: 2.8.000 (2008-03-19)
$linethrough

line through state

from  TCPDF
protected Since: 5.8.014 (2010-08-23)
$ur

Array with additional document-wide usage rights for the document.

from  TCPDF
protected Since: 3.0.000 (2008-03-27)
$dpi

DPI (Dot Per Inch) Document Resolution (do not change).

from  TCPDF
protected Since: 3.0.000 (2008-03-27)
$newpagegroup

Array of page numbers were a new page group was started (the page numbers are the keys of the array).

from  TCPDF
protected Since: 3.0.000 (2008-03-27)
$pagegroups

Array that contains the number of pages in each page group.

from  TCPDF
protected Since: 3.0.000 (2008-03-27)
$currpagegroup

Current page group number.

from  TCPDF
protected Since: 3.0.000 (2008-03-27)
$extgstates

Array of transparency objects and parameters.

from  TCPDF
protected Since: 3.0.000 (2008-03-27)
$jpeg_quality

Set the default JPEG compression quality (1-100).

from  TCPDF
protected float Since: 3.0.014 (2008-05-23)
$cell_height_ratio

Default cell height ratio.

from  TCPDF
protected Since: 3.1.000 (2008-06-09)
$viewer_preferences

PDF viewer preferences.

from  TCPDF
protected Since: 3.1.000 (2008-06-09)
$PageMode

A name object specifying how the document should be displayed when opened.

from  TCPDF
protected Since: 3.1.000 (2008-06-09)
$gradients

Array for storing gradient information.

from  TCPDF
protected Since: 3.2.000 (2008-06-26)
$intmrk

Array used to store positions inside the pages buffer (keys are the page numbers).

from  TCPDF
protected Since: 5.7.000 (2010-08-03)
$bordermrk

Array used to store positions inside the pages buffer (keys are the page numbers).

from  TCPDF
protected Since: 5.8.007 (2010-08-18)
$emptypagemrk

Array used to store page positions to track empty pages (keys are the page numbers).

from  TCPDF
protected Since: 4.6.021 (2009-07-20)
$cntmrk

Array used to store content positions inside the pages buffer (keys are the page numbers).

from  TCPDF
protected Since: 3.2.000 (2008-07-01)
$footerpos

Array used to store footer positions of each page.

from  TCPDF
protected Since: 4.0.014 (2008-07-29)
$footerlen

Array used to store footer length of each page.

from  TCPDF
protected Since: 3.2.000 (2008-07-01)
$newline

Boolean flag to indicate if a new line is created.

from  TCPDF
protected Since: 3.2.000 (2008-07-01)
$endlinex

End position of the latest inserted line.

from  TCPDF
protected Since: 4.0.006 (2008-07-16)
$linestyleWidth

PDF string for width value of the last line.

from  TCPDF
protected Since: 4.0.006 (2008-07-16)
$linestyleCap

PDF string for CAP value of the last line.

from  TCPDF
protected Since: 4.0.006 (2008-07-16)
$linestyleJoin

PDF string for join value of the last line.

from  TCPDF
protected Since: 4.0.006 (2008-07-16)
$linestyleDash

PDF string for dash value of the last line.

from  TCPDF
protected Since: 4.0.013 (2008-07-28)
$openMarkedContent

Boolean flag to indicate if marked-content sequence is open.

from  TCPDF
protected Since: 4.0.021 (2008-08-24)
$htmlvspace

Count the latest inserted vertical spaces on HTML.

from  TCPDF
protected Since: 4.0.024 (2008-09-12)
$spot_colors

Array of Spot colors.

from  TCPDF
protected Since: 4.0.028 (2008-09-26)
$lisymbol

Symbol used for HTML unordered list items.

from  TCPDF
protected Since: 4.1.000 (2008-10-18)
$epsmarker

String used to mark the beginning and end of EPS image blocks.

from  TCPDF
protected Since: 4.2.000 (2008-10-29)
$transfmatrix

Array of transformation matrix.

from  TCPDF
protected Since: 4.8.005 (2009-09-17)
$transfmatrix_key

Current key for transformation matrix.

from  TCPDF
protected Since: 4.2.000 (2008-10-29)
$booklet

Booklet mode for double-sided pages.

from  TCPDF
protected Since: 4.2.000 (2008-10-29)
$feps

Epsilon value used for float calculations.

from  TCPDF
protected Since: 4.2.001 (2008-10-30)
$tagvspaces

Array used for custom vertical spaces for HTML tags.

from  TCPDF
protected Since: 4.2.007 (2008-11-12)
$customlistindent

HTML PARSER: custom indent amount for lists. Negative value means disabled.

from  TCPDF
protected Since: 4.2.010 (2008-11-14)
$opencell

Boolean flag to indicate if the border of the cell sides that cross the page should be removed.

from  TCPDF
protected Since: 4.4.000 (2008-12-07)
$embeddedfiles

Array of files to embedd.

from  TCPDF
protected Since: 4.4.001 (2008-12-08)
$premode

Boolean flag to indicate if we are inside a PRE tag.

from  TCPDF
protected Since: 4.4.002 (2008-12-09)
$transfmrk

Array used to store positions of graphics transformation blocks inside the page buffer.

from  TCPDF
protected Since: 4.4.003 (2008-12-09)
$htmlLinkColorArray

Default color for html links.

from  TCPDF
protected Since: 4.4.003 (2008-12-09)
$htmlLinkFontStyle

Default font style to add to html links.

from  TCPDF
protected Since: 4.5.000 (2008-12-31)
$numpages

Counts the number of pages.

from  TCPDF
protected Since: 4.5.000 (2008-12-31)
$pagelen

Array containing page lengths in bytes.

from  TCPDF
protected Since: 4.5.000 (2008-12-31)
$numimages

Counts the number of pages.

from  TCPDF
protected Since: 4.5.000 (2008-12-31)
$imagekeys

Store the image keys.

from  TCPDF
protected Since: 4.5.000 (2008-12-31)
$bufferlen

Length of the buffer in bytes.

from  TCPDF
protected Since: 4.5.000 (2009-01-02)
$numfonts

Counts the number of fonts.

from  TCPDF
protected Since: 4.5.000 (2009-01-02)
$fontkeys

Store the font keys.

from  TCPDF
protected Since: 4.8.001 (2009-09-09)
$font_obj_ids

Store the font object IDs.

from  TCPDF
protected Since: 4.5.000 (2009-01-02)
$pageopen

Store the fage status (true when opened, false when closed).

from  TCPDF
protected Since: 4.5.025 (2009-03-10)
$default_monospaced_font

Default monospace font.

from  TCPDF
protected Since: 4.5.029 (2009-03-19)
$objcopy

Cloned copy of the current class object.

from  TCPDF
protected Since: 4.5.029 (2009-03-19)
$cache_file_length

Array used to store the lengths of cache files.

from  TCPDF
protected Since: 4.5.030 (2009-03-20)
$thead

Table header content to be repeated on each new page.

from  TCPDF
protected Since: 4.5.030 (2009-03-20)
$theadMargins

Margins used for table header.

from  TCPDF
protected Since: 4.6.005 (2009-04-24)
$sign

Boolean flag to enable document digital signature.

from  TCPDF
protected Since: 4.6.005 (2009-04-24)
$signature_data

Digital signature data.

from  TCPDF
protected Since: 4.6.005 (2009-04-24)
$signature_max_length

Digital signature max length.

from  TCPDF
protected Since: 5.3.011 (2010-06-16)
$signature_appearance

Data for digital signature appearance.

from  TCPDF
protected Since: 5.9.101 (2011-07-06)
$empty_signature_appearance

Array of empty digital signature appearances.

from  TCPDF
protected Since: 6.0.085 (2014-06-19)
$tsa_timestamp

Boolean flag to enable document timestamping with TSA.

from  TCPDF
protected Since: 6.0.085 (2014-06-19)
$tsa_data

Timestamping data.

from  TCPDF
protected Since: 4.6.006 (2009-04-28)
$re_spaces

Regular expression used to find blank characters (required for word-wrapping).

from  TCPDF
protected Since: 5.5.011 (2010-07-09)
$re_space

Array of $re_spaces parts.

from  TCPDF
protected Since: 4.6.022 (2009-06-23)
$sig_obj_id

Digital signature object ID.

from  TCPDF
protected Since: 4.7.000 (2009-08-29)
$page_obj_id

ID of page objects.

from  TCPDF
protected Since: 4.8.000 (2009-09-07)
$form_obj_id

List of form annotations IDs.

from  TCPDF
protected Since: 4.8.000 (2009-09-07)
$default_form_prop

Deafult Javascript field properties. Possible values are described on official Javascript for Acrobat API reference. Annotation options can be directly specified using the 'aopt' entry.

from  TCPDF
protected Since: 4.8.000 (2009-09-07)
$js_objects

Javascript objects array.

from  TCPDF
protected Since: 4.8.000 (2009-09-07)
$form_action

Current form action (used during XHTML rendering).

from  TCPDF
protected Since: 4.8.000 (2009-09-07)
$form_enctype

Current form encryption type (used during XHTML rendering).

from  TCPDF
protected Since: 4.8.000 (2009-09-07)
$form_mode

Current method to submit forms.

from  TCPDF
protected Since: 4.8.001 (2009-09-09)
$annotation_fonts

List of fonts used on form fields (fontname => fontkey).

from  TCPDF
protected Since: 4.8.001 (2009-09-09)
$radiobutton_groups

List of radio buttons parent objects.

from  TCPDF
protected Since: 4.8.001 (2009-09-09)
$radio_groups

List of radio group objects IDs.

from  TCPDF
protected Since: 4.8.006 (2009-09-23)
$textindent

Text indentation value (used for text-indent CSS attribute).

from  TCPDF
protected Since: 4.8.006 (2009-09-23)
$start_transaction_page

Store page number when startTransaction() is called.

from  TCPDF
protected Since: 4.9.001 (2010-03-28)
$start_transaction_y

Store Y position when startTransaction() is called.

from  TCPDF
protected Since: 4.8.027 (2010-01-25)
$inthead

True when we are printing the thead section on a new page.

from  TCPDF
protected Since: 4.9.001 (2010-03-28)
$columns

Array of column measures (width, space, starting Y position).

from  TCPDF
protected Since: 4.9.001 (2010-03-28)
$num_columns

Number of colums.

from  TCPDF
protected Since: 4.9.001 (2010-03-28)
$current_column

Current column number.

from  TCPDF
protected Since: 4.9.001 (2010-03-28)
$column_start_page

Starting page for columns.

from  TCPDF
protected Since: 5.8.000 (2010-08-11)
$maxselcol

Maximum page and column selected.

from  TCPDF
protected Since: 5.8.000 (2010-08-11)
$colxshift

Array of: X difference between table cell x start and starting page margin, cellspacing, cellpadding.

from  TCPDF
protected Since: 4.9.008 (2010-04-03)
$textrendermode

Text rendering mode: 0 = Fill text; 1 = Stroke text; 2 = Fill, then stroke text; 3 = Neither fill nor stroke text (invisible); 4 = Fill text and add to path for clipping; 5 = Stroke text and add to path for clipping; 6 = Fill, then stroke text and add to path for clipping; 7 = Add text to path for clipping.

from  TCPDF
protected Since: 4.9.008 (2010-04-03)
$textstrokewidth

Text stroke width in doc units.

from  TCPDF
protected Since: 4.9.008 (2010-04-03)
$strokecolor

Current stroke color.

from  TCPDF
protected Since: 5.0.000 (2010-04-22)
$pdfunit

Default unit of measure for document.

from  TCPDF
protected $tocpage

Boolean flag true when we are on TOC (Table Of Content) page.

from  TCPDF
protected Since: 5.0.000 (2010-04-26)
$rasterize_vector_images

Boolean flag: if true convert vector images (SVG, EPS) to raster image using GD or ImageMagick library.

from  TCPDF
protected Since: 5.3.002 (2010-06-07)
$font_subsetting

Boolean flag: if true enables font subsetting by default.

from  TCPDF
protected Since: 5.5.008 (2010-07-02)
$default_graphic_vars

Array of default graphic settings.

from  TCPDF
protected Since: 5.8.014 (2010-08-23)
$xobjects

Array of XObjects.

from  TCPDF
protected Since: 5.8.017 (2010-08-24)
$inxobj

Boolean value true when we are inside an XObject.

from  TCPDF
protected Since: 5.8.017 (2010-08-24)
$xobjid

Current XObject ID.

from  TCPDF
protected Since: 5.9.000 (2010-09-29)
$font_stretching

Percentage of character stretching.

from  TCPDF
protected Since: 5.9.000 (2010-09-29)
$font_spacing

Increases or decreases the space between characters in a text by the specified amount (tracking).

from  TCPDF
protected Since: 5.9.003 (2010-10-14)
$page_regions

Array of no-write regions.

from  TCPDF
protected $check_page_regions

Boolean value true when page region check is active.

from  TCPDF
protected Since: 5.9.102 (2011-07-13)
$pdflayers

Array of PDF layers data.

from  TCPDF
protected Since: 5.9.097 (2011-06-23)
$dests

A dictionary of names and corresponding destinations (Dests key on document Catalog).

from  TCPDF
protected Since: 5.9.097 (2011-06-23)
$n_dests

Object ID for Named Destinations

from  TCPDF
protected Since: 5.9.204 (2013-01-23)
$efnames

Embedded Files Names

from  TCPDF
protected Since: 5.0.000 (2010-05-05)
$svgdir

Directory used for the last SVG image.

from  TCPDF
protected Since: 5.0.000 (2010-05-02)
$svgunit

Deafult unit of measure for SVG.

from  TCPDF
protected Since: 5.0.000 (2010-05-02)
$svggradients

Array of SVG gradients.

from  TCPDF
protected Since: 5.0.000 (2010-05-02)
$svggradientid

ID of last SVG gradient.

from  TCPDF
protected Since: 5.0.000 (2010-05-02)
$svgdefsmode

Boolean value true when in SVG defs group.

from  TCPDF
protected Since: 5.0.000 (2010-05-02)
$svgdefs

Array of SVG defs.

from  TCPDF
protected Since: 5.0.000 (2010-04-26)
$svgclipmode

Boolean value true when in SVG clipPath tag.

from  TCPDF
protected Since: 5.0.000 (2010-05-02)
$svgclippaths

Array of SVG clipPath commands.

from  TCPDF
protected Since: 5.8.022 (2010-08-31)
$svgcliptm

Array of SVG clipPath tranformation matrix.

from  TCPDF
protected Since: 5.0.000 (2010-05-02)
$svgclipid

ID of last SVG clipPath.

from  TCPDF
protected Since: 5.0.000 (2010-05-02)
$svgtext

SVG text.

from  TCPDF
protected Since: 5.8.013 (2010-08-23)
$svgtextmode

SVG text properties.

from  TCPDF
protected Since: 5.0.000 (2010-05-02)
$svgstyles

Array of SVG properties.

from  TCPDF
protected Since: 5.9.121 (2011-09-28)
$force_srgb

If true force sRGB color profile for all document.

from  TCPDF
protected Since: 5.9.121 (2011-09-27)
$pdfa_mode

If true set the document to PDF/A mode.

from  TCPDF
protected Since: 6.2.26 (2019-03-12)
$pdfa_version

version of PDF/A mode (1 - 3).

from  TCPDF
protected Since: 5.9.152 (2012-03-22)
$doc_creation_timestamp

Document creation date-time

from  TCPDF
protected Since: 5.9.152 (2012-03-22)
$doc_modification_timestamp

Document modification date-time

from  TCPDF
protected Since: 5.9.128 (2011-10-06)
$custom_xmp

Custom XMP data.

from  TCPDF
protected Since: 6.3.0 (2019-09-19)
$custom_xmp_rdf

Custom XMP RDF data.

from  TCPDF
protected array<string,bool|int> Since: 5.9.152 (2012-03-23)
$overprint

Overprint mode array.

from  TCPDF
protected Since: 5.9.152 (2012-03-23)
$alpha

Alpha mode array.

from  TCPDF
protected Since: 5.9.152 (2012-03-23)
$page_boxes

Define the page boundaries boxes to be set on document.

from  TCPDF
$tcpdflink

If true print TCPDF meta link.

from  TCPDF
protected Since: 5.9.1632 (2012-06-05)
$gdgammacache

Cache array for computed GD gamma values.

from  TCPDF
protected array Since: 6.3.5 (2020-09-28)
$fileContentCache

Cache array for file content

from  TCPDF
protected bool Since: 6.4 (2020-07-23)
$allowLocalFiles

Whether to allow local file path in image html tags, when prefixed with file://

from  TCPDF
static protected $cleaned_ids from  TCPDF

Methods

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

This is the class constructor.

from  TCPDF
__destruct()

Default destructor.

from  TCPDF
setPageUnit(string $unit)

Set the units of measure for the document.

from  TCPDF
setPageFormat(mixed $format, string $orientation = 'P')

Change the format of the current page

from  TCPDF
setPageOrientation(string $orientation, bool|null $autopagebreak = null, float|null $bottommargin = null)

Set page orientation.

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

Set regular expression to detect withespaces or word separators.

from  TCPDF
setRTL(bool $enable, bool $resetx = true)

Enable or disable Right-To-Left language mode

from  TCPDF
bool
getRTL()

Return the RTL status

from  TCPDF
setTempRTL(false|string $mode)

Force temporary RTL language direction

from  TCPDF
bool
isRTLTextDir()

Return the current temporary RTL status

from  TCPDF
setLastH(float $h)

Set the last cell height.

from  TCPDF
float
getCellHeight(int $fontsize, bool $padding = TRUE)

Return the cell height

from  TCPDF
resetLastH()

Reset the last cell height.

from  TCPDF
float
getLastH()

Get the last cell height.

from  TCPDF
setImageScale(float $scale)

Set the adjusting factor to convert pixels to user units.

from  TCPDF
float
getImageScale()

Returns the adjusting factor to convert pixels to user units.

from  TCPDF
array
getPageDimensions(int|null $pagenum = null)

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

from  TCPDF
int|float
getPageWidth(int|null $pagenum = null)

Returns the page width in units.

from  TCPDF
int|float
getPageHeight(int|null $pagenum = null)

Returns the page height in units.

from  TCPDF
int|float
getBreakMargin(int|null $pagenum = null)

Returns the page break margin.

from  TCPDF
int
getScaleFactor()

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

from  TCPDF
setMargins(int|float $left, int|float $top, int|float|null $right = null, bool $keepmargins = false)

Defines the left, top and right margins.

from  TCPDF
setLeftMargin(int|float $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.

from  TCPDF
setTopMargin(int|float $margin)

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

from  TCPDF
setRightMargin(int|float $margin)

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

from  TCPDF
setCellPadding(int|float $pad)

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

from  TCPDF
setCellPaddings(int|float|null $left = null, int|float|null $top = null, int|float|null $right = null, int|float|null $bottom = null)

Set the internal Cell paddings.

from  TCPDF
array
getCellPaddings()

Get the internal Cell padding array.

from  TCPDF
setCellMargins(int|float|null $left = null, int|float|null $top = null, int|float|null $right = null, int|float|null $bottom = null)

Set the internal Cell margins.

from  TCPDF
array
getCellMargins()

Get the internal Cell margin array.

from  TCPDF
void|array
adjustCellPadding(string|array|int|bool $brd = 0)

Adjust the internal Cell padding array to take account of the line width.

from  TCPDF
setAutoPageBreak(bool $auto, float $margin = 0)

Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.

from  TCPDF
bool
getAutoPageBreak()

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

from  TCPDF
setDisplayMode(mixed $zoom, string $layout = 'SinglePage', string $mode = 'UseNone')

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

from  TCPDF
setCompression(bool $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.

from  TCPDF
setSRGBmode(bool $mode = false)

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

from  TCPDF
setDocInfoUnicode(bool $unicode = true)

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

from  TCPDF
setTitle(string $title)

Defines the title of the document.

from  TCPDF
setSubject(string $subject)

Defines the subject of the document.

from  TCPDF
setAuthor(string $author)

Defines the author of the document.

from  TCPDF
setKeywords(string $keywords)

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

from  TCPDF
setCreator(string $creator)

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

from  TCPDF
setAllowLocalFiles(bool $allowLocalFiles)

Whether to allow local file path in image html tags, when prefixed with file://

from  TCPDF
Error(string $msg)

Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.

from  TCPDF
Open()

This method begins the generation of the PDF document.

from  TCPDF
Close()

Terminates the PDF document.

from  TCPDF
setPage(int $pnum, bool $resetmargins = false)

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

from  TCPDF
lastPage(bool $resetmargins = false)

Reset pointer to the last document page.

from  TCPDF
int
getPage()

Get current document page number.

from  TCPDF
int
getNumPages()

Get the total number of insered pages.

from  TCPDF
addTOCPage(string $orientation = '', mixed $format = '', bool $keepmargins = false)

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

from  TCPDF
endTOCPage()

Terminate the current TOC (Table Of Content) page

from  TCPDF
AddPage(string $orientation = '', mixed $format = '', bool $keepmargins = false, bool $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).

from  TCPDF
endPage(bool $tocpage = false)

Terminate the current page

from  TCPDF
startPage(string $orientation = '', mixed $format = '', bool $tocpage = false)

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

from  TCPDF
setPageMark()

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

from  TCPDF
setContentMark(int $page = 0)

Set start-writing mark on selected page.

from  TCPDF
setHeaderData(string $ln = '', int $lw = 0, string $ht = '', string $hs = '', int[] $tc = array(0, 0, 0), int[] $lc = array(0, 0, 0))

Set header data.

from  TCPDF
setFooterData(int[] $tc = array(0, 0, 0), int[] $lc = array(0, 0, 0))

Set footer data.

from  TCPDF
array<string,mixed>
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

from  TCPDF
setHeaderMargin(float $hm = 10)

Set header margin.

from  TCPDF
float
getHeaderMargin()

Returns header margin in user units.

from  TCPDF
setFooterMargin(float $fm = 10)

Set footer margin.

from  TCPDF
float
getFooterMargin()

Returns footer margin in user units.

from  TCPDF
setPrintHeader(bool $val = true)

Set a flag to print page header.

from  TCPDF
setPrintFooter(bool $val = true)

Set a flag to print page footer.

from  TCPDF
float
getImageRBX()

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

from  TCPDF
float
getImageRBY()

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

from  TCPDF
resetHeaderTemplate()

Reset the xobject template used by Header() method.

from  TCPDF
setHeaderTemplateAutoreset(bool $val = true)

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

from  TCPDF
Header()

This method is used to render the page header.

from  TCPDF
Footer()

This method is used to render the page footer.

from  TCPDF
setHeader()

This method is used to render the page header.

from  TCPDF
setFooter()

This method is used to render the page footer.

from  TCPDF
bool
inPageBody()

Check if we are on the page body (excluding page header and footer).

from  TCPDF
setTableHeader()

This method is used to render the table header on new page (if any).

from  TCPDF
int
PageNo()

Returns the current page number.

from  TCPDF
array
getAllSpotColors()

Returns the array of spot colors.

from  TCPDF
AddSpotColor(string $name, float $c, float $m, float $y, float $k)

Defines a new spot color.

from  TCPDF
string
setSpotColor(string $type, string $name, float $tint = 100)

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

from  TCPDF
setDrawSpotColor(string $name, float $tint = 100)

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

from  TCPDF
setFillSpotColor(string $name, float $tint = 100)

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

from  TCPDF
setTextSpotColor(string $name, int $tint = 100)

Defines the spot color used for text.

from  TCPDF
string
setColorArray(string $type, array $color, bool $ret = false)

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

from  TCPDF
string
setDrawColorArray(array $color, bool $ret = false)

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

from  TCPDF
setFillColorArray(array $color, bool $ret = false)

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

from  TCPDF
setTextColorArray(array $color, bool $ret = false)

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

from  TCPDF
string
setColor(string $type, float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $name = '')

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

from  TCPDF
string
setDrawColor(float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $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.

from  TCPDF
string
setFillColor(float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $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.

from  TCPDF
string
setTextColor(float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $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.

from  TCPDF
float[]|float
GetStringWidth(string $s, string $fontname = '', string $fontstyle = '', float $fontsize = 0, bool $getarray = false)

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

from  TCPDF
float[]|float
GetArrStringWidth(array $sa, string $fontname = '', string $fontstyle = '', float $fontsize = 0, bool $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.

from  TCPDF
float
GetCharWidth(int $char, bool $notlast = true)

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

from  TCPDF
float
getRawCharWidth(int $char)

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

from  TCPDF
int
GetNumChars(string $s)

Returns the numbero of characters in a string.

from  TCPDF
getFontsList()

Fill the list of available fonts ($this->fontlist).

from  TCPDF
array|false
AddFont(string $family, string $style = '', string $fontfile = '', mixed $subset = 'default')

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

from  TCPDF
setFont(string $family, string $style = '', float|null $size = null, string $fontfile = '', mixed $subset = 'default', bool $out = true)

Sets the font used to print character strings.

from  TCPDF
setFontSize(float $size, bool $out = true)

Defines the size of the current font.

from  TCPDF
array
getFontBBox()

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

from  TCPDF
float
getAbsFontMeasure(int $s)

Convert a relative font measure into absolute value.

from  TCPDF
false|array
getCharBBox(int $char)

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

from  TCPDF
int
getFontDescent(string $font, string $style = '', float $size = 0)

Return the font descent value

from  TCPDF
int
getFontAscent(string $font, string $style = '', float $size = 0)

Return the font ascent value.

from  TCPDF
bool
isCharDefined(mixed $char, string $font = '', string $style = '')

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

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

Replace missing font characters on selected font with specified substitutions.

from  TCPDF
setDefaultMonospacedFont(string $font)

Defines the default monospaced font.

from  TCPDF
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().

from  TCPDF
setLink(int $link, float $y = 0, int|string $page = -1)

Defines the page and position a link points to.

from  TCPDF
Link(float $x, float $y, float $w, float $h, mixed $link, int $spaces = 0)

Puts a link on a rectangular area of the page.

from  TCPDF
Annotation(float $x, float $y, float $w, float $h, string $text, array $opt = array('Subtype' => 'Text'), int $spaces = 0)

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

from  TCPDF
_putEmbeddedFiles()

Embedd the attached files.

from  TCPDF
Text(float $x, float $y, string $txt, int $fstroke = 0, bool $fclip = false, bool $ffill = true, mixed $border = 0, int $ln = 0, string $align = '', bool $fill = false, mixed $link = '', int $stretch = 0, bool $ignore_min_height = false, string $calign = 'T', string $valign = 'M', bool $rtloff = false)

Prints a text cell at the specified position.

from  TCPDF
bool
AcceptPageBreak()

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

from  TCPDF
bool
checkPageBreak(float $h = 0, float|null $y = null, bool $addpage = true)

Add page if needed.

from  TCPDF
Cell(float $w, float $h = 0, string $txt = '', mixed $border = 0, int $ln = 0, string $align = '', bool $fill = false, mixed $link = '', int $stretch = 0, bool $ignore_min_height = false, string $calign = 'T', string $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.

from  TCPDF
string
getCellCode(float $w, float $h = 0, string $txt = '', mixed $border = 0, int $ln = 0, string $align = '', bool $fill = false, mixed $link = '', int $stretch = 0, bool $ignore_min_height = false, string $calign = 'T', string $valign = 'M')

Returns the PDF string code to print a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.

from  TCPDF
int
replaceChar(int $oldchar, int $newchar)

Replace a char if is defined on the current font.

from  TCPDF
string
getCellBorder(float $x, float $y, float $w, float $h, string|array|int $brd)

Returns the code to draw the cell border

from  TCPDF
int
MultiCell(float $w, float $h, string $txt, mixed $border = 0, string $align = 'J', bool $fill = false, int $ln = 1, float|null $x = null, float|null $y = null, bool $reseth = true, int $stretch = 0, bool $ishtml = false, bool $autopadding = true, float $maxh = 0, string $valign = 'T', bool $fitcell = false)

This method allows printing text with line breaks.

from  TCPDF
float
getNumLines(string $txt, float $w = 0, bool $reseth = false, bool $autopadding = true, array|null $cellpadding = null, mixed $border = 0)

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

from  TCPDF
float
getStringHeight(float $w, string $txt, bool $reseth = false, bool $autopadding = true, array|null $cellpadding = null, mixed $border = 0)

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

from  TCPDF
mixed
Write(float $h, string $txt, mixed $link = '', bool $fill = false, string $align = '', bool $ln = false, int $stretch = 0, bool $firstline = false, bool $firstblock = false, float $maxh = 0, float $wadj = 0, array|null $margin = null)

This method prints text from the current position.

from  TCPDF
float
getRemainingWidth()

Returns the remaining width between the current position and margins.

from  TCPDF
array
fitBlock(float $w, float $h, float $x, float $y, bool $fitonpage = false)

Set the block dimensions accounting for page breaks and page/column fitting

from  TCPDF
mixed|false
Image(string $file, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, string $type = '', mixed $link = '', string $align = '', mixed $resize = false, int $dpi = 300, string $palign = '', bool $ismask = false, mixed $imgmask = false, mixed $border = 0, mixed $fitbox = false, bool $hidden = false, bool $fitonpage = false, bool $alt = false, array $altimgs = array())

Puts an image in the page.

from  TCPDF
ImagePngAlpha(string $file, float $x, float $y, float $wpx, float $hpx, float $w, float $h, string $type, mixed $link, string $align, bool $resize, int $dpi, string $palign, string $filehash = '')

Extract info from a PNG image with alpha channel using the Imagick or GD library.

from  TCPDF
getGDgamma(resource $img, int $c)

Get the GD-corrected PNG gamma value from alpha color

from  TCPDF
Ln(float|null $h = null, bool $cell = false)

Performs a line break.

from  TCPDF
float
GetX()

Returns the relative X value of current position.

from  TCPDF
float
GetAbsX()

Returns the absolute X value of current position.

from  TCPDF
float
GetY()

Returns the ordinate of the current position.

from  TCPDF
setX(float $x, bool $rtloff = false)

Defines the abscissa of the current position.

from  TCPDF
setY(float $y, bool $resetx = true, bool $rtloff = false)

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

from  TCPDF
setXY(float $x, float $y, bool $rtloff = false)

Defines the abscissa and ordinate of the current position.

from  TCPDF
setAbsX(float $x)

Set the absolute X coordinate of the current pointer.

from  TCPDF
setAbsY(float $y)

Set the absolute Y coordinate of the current pointer.

from  TCPDF
setAbsXY(float $x, float $y)

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

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

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

from  TCPDF
_destroy(bool $destroyall = false, bool $preserve_objcopy = false)

Unset all class variables except the following critical variables.

from  TCPDF
_dochecks()

Check for locale-related bug

from  TCPDF
array
getInternalPageNumberAliases(string $a = '')

Return an array containing variations for the basic page number alias.

from  TCPDF
array
getAllInternalPageNumberAliases()

Return an array containing all internal page aliases.

from  TCPDF
string
replaceRightShiftPageNumAliases(string $page, array $aliases, int $diff)

Replace right shift page number aliases with spaces to correct right alignment.

from  TCPDF
setPageBoxTypes(array $boxes)

Set page boxes to be included on page descriptions.

from  TCPDF
_putpages()

Output pages (and replace page number aliases).

from  TCPDF
string
_getannotsrefs(int $n)

Get references to page annotations.

from  TCPDF
_putannotsobjs()

Output annotations objects for all pages.

from  TCPDF
int
_putAPXObject(int $w = 0, int $h = 0, string $stream = '')

Put appearance streams XObject used to define annotation's appearance states.

from  TCPDF
_putfonts()

Output fonts.

from  TCPDF
_puttruetypeunicode(array $font)

Adds unicode fonts.
Based on PDF Reference 1.3 (section 5)

from  TCPDF
_putcidfont0(array $font)

Output CID-0 fonts.

from  TCPDF
_putimages()

Output images.

from  TCPDF
_putxobjects()

Output Form XObjects Templates.

from  TCPDF
_putspotcolors()

Output Spot Colors Resources.

from  TCPDF
string
_getxobjectdict()

Return XObjects Dictionary.

from  TCPDF
_putresourcedict()

Output Resources Dictionary.

from  TCPDF
_putresources()

Output Resources.

from  TCPDF
int
_putinfo()

Adds some Metadata information (Document Information Dictionary) (see Chapter 14.3.3 Document Information Dictionary of PDF32000_2008.pdf Reference)

from  TCPDF
setExtraXMP(string $xmp)

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

from  TCPDF
setExtraXMPRDF(string $xmp)

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

from  TCPDF
int
_putXMP()

Put XMP data object and return ID.

from  TCPDF
int
_putcatalog()

Output Catalog.

from  TCPDF
string
_putviewerpreferences()

Output viewer preferences.

from  TCPDF
_putheader()

Output PDF File Header (7.5.2).

from  TCPDF
_enddoc()

Output end of document (EOF).

from  TCPDF
_beginpage(string $orientation = '', mixed $format = '')

Initialize a new page.

from  TCPDF
_endpage()

Mark end of page.

from  TCPDF
int
_newobj()

Begin a new object and return the object number.

from  TCPDF
string
_getobj(int|null $objid = null)

Return the starting object string for the selected object ID.

from  TCPDF
_dounderline(int $x, int $y, string $txt)

Underline text.

from  TCPDF
_dounderlinew(int $x, int $y, int $w)

Underline for rectangular text area.

from  TCPDF
_dolinethrough(int $x, int $y, string $txt)

Line through text.

from  TCPDF
_dolinethroughw(int $x, int $y, int $w)

Line through for rectangular text area.

from  TCPDF
_dooverline(int $x, int $y, string $txt)

Overline text.

from  TCPDF
_dooverlinew(int $x, int $y, int $w)

Overline for rectangular text area.

from  TCPDF
string
_datastring(string $s, int $n = 0)

Format a data string for meta information

from  TCPDF
setDocCreationTimestamp(mixed $time)

Set the document creation timestamp

from  TCPDF
setDocModificationTimestamp(mixed $time)

Set the document modification timestamp

from  TCPDF
int
getDocCreationTimestamp()

Returns document creation timestamp in seconds.

from  TCPDF
int
getDocModificationTimestamp()

Returns document modification timestamp in seconds.

from  TCPDF
string
_datestring(int $n = 0, int $timestamp = 0)

Returns a formatted date for meta information

from  TCPDF
string
_textstring(string $s, int $n = 0)

Format a text string for meta information

from  TCPDF
_getrawstream(string $s, int $n = 0)

get raw output stream.

from  TCPDF
_out(string $s)

Output a string to the document.

from  TCPDF
setHeaderFont(array<int,string|float|null> $font)

Set header font.

from  TCPDF
array<int,string|float|null>
getHeaderFont()

Get header font.

from  TCPDF
setFooterFont(array<int,string|float|null> $font)

Set footer font.

from  TCPDF
array<int,string|float|null>
getFooterFont()

Get Footer font.

from  TCPDF
setLanguageArray(array $language)

Set language array.

from  TCPDF
getPDFData()

Returns the PDF data.

from  TCPDF
int
addHtmlLink(string $url, string $name, bool $fill = false, bool $firstline = false, array|null $color = null, string $style = -1, bool $firstblock = false)

Output anchor link.

from  TCPDF
float
pixelsToUnits(int $px)

Converts pixels to User's Units.

from  TCPDF
string
unhtmlentities(string $text_to_convert)

Reverse function for htmlentities.

from  TCPDF
int
_objectkey(int $n)

Compute encryption key depending on object number where the encrypted data is stored.

from  TCPDF
string
_encrypt_data(int $n, string $s)

Encrypt the input string.

from  TCPDF
_putencryption()

Put encryption on PDF document.

from  TCPDF
string
_Uvalue()

Compute U value (used for encryption)

from  TCPDF
string
_UEvalue()

Compute UE value (used for encryption)

from  TCPDF
string
_Ovalue()

Compute O value (used for encryption)

from  TCPDF
string
_OEvalue()

Compute OE value (used for encryption)

from  TCPDF
string
_fixAES256Password(string $password)

Convert password for AES-256 encryption mode

from  TCPDF
_generateencryptionkey()

Compute encryption key

from  TCPDF
setProtection(array $permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), string $user_pass = '', string|null $owner_pass = null, int $mode = 0, array|null $pubkeys = null)

Set document protection Remark: the protection against modification is for people who have the full Acrobat product.

from  TCPDF
StartTransform()

Starts a 2D tranformation saving current graphic state.

from  TCPDF
StopTransform()

Stops a 2D tranformation restoring previous graphic state.

from  TCPDF
ScaleX(float $s_x, int $x = '', int $y = '')

Horizontal Scaling.

from  TCPDF
ScaleY(float $s_y, int $x = '', int $y = '')

Vertical Scaling.

from  TCPDF
ScaleXY(float $s, int $x = '', int $y = '')

Vertical and horizontal proportional Scaling.

from  TCPDF
Scale(float $s_x, float $s_y, float|null $x = null, float|null $y = null)

Vertical and horizontal non-proportional Scaling.

from  TCPDF
MirrorH(float|null $x = null)

Horizontal Mirroring.

from  TCPDF
MirrorV(float|null $y = null)

Verical Mirroring.

from  TCPDF
MirrorP(float|null $x = null, float|null $y = null)

Point reflection mirroring.

from  TCPDF
MirrorL(float $angle = 0, float|null $x = null, float|null $y = null)

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

from  TCPDF
TranslateX(int $t_x)

Translate graphic object horizontally.

from  TCPDF
TranslateY(int $t_y)

Translate graphic object vertically.

from  TCPDF
Translate(int $t_x, int $t_y)

Translate graphic object horizontally and vertically.

from  TCPDF
Rotate(float $angle, float|null $x = null, float|null $y = null)

Rotate object.

from  TCPDF
SkewX(float $angle_x, float|null $x = null, float|null $y = null)

Skew horizontally.

from  TCPDF
SkewY(float $angle_y, float|null $x = null, float|null $y = null)

Skew vertically.

from  TCPDF
Skew(float $angle_x, float $angle_y, float|null $x = null, float|null $y = null)

Skew.

from  TCPDF
Transform(array $tm)

Apply graphic transformations.

from  TCPDF
setLineWidth(float $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.

from  TCPDF
int
GetLineWidth()

Returns the current the line width.

from  TCPDF
string
setLineStyle(array $style, bool $ret = false)

Set line style.

from  TCPDF
_outPoint(float $x, float $y)

Begin a new subpath by moving the current point to coordinates (x, y), omitting any connecting line segment.

from  TCPDF
_outLine(float $x, float $y)

Append a straight line segment from the current point to the point (x, y).

from  TCPDF
_outRect(float $x, float $y, float $w, float $h, string $op)

Append a rectangle to the current path as a complete subpath, with lower-left corner (x, y) and dimensions widthand height in user space.

from  TCPDF
_outCurve(float $x1, float $y1, float $x2, float $y2, float $x3, float $y3)

Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as the Bezier control points.

from  TCPDF
_outCurveV(float $x2, float $y2, float $x3, float $y3)

Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using the current point and (x2, y2) as the Bezier control points.

from  TCPDF
_outCurveY(float $x1, float $y1, float $x3, float $y3)

Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the Bezier control points.

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

Draws a line between two points.

from  TCPDF
Rect(float $x, float $y, float $w, float $h, string $style = '', array $border_style = array(), array $fill_color = array())

Draws a rectangle.

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

Draws a Bezier curve.

from  TCPDF
Polycurve(float $x0, float $y0, float[] $segments, string $style = '', array $line_style = array(), array $fill_color = array())

Draws a poly-Bezier curve.

from  TCPDF
Ellipse(float $x0, float $y0, float $rx, float $ry = 0, float $angle = 0, float $astart = 0, float $afinish = 360, string $style = '', array $line_style = array(), array $fill_color = array(), int $nc = 2)

Draws an ellipse.

from  TCPDF
array
_outellipticalarc(float $xc, float $yc, float $rx, float $ry, float $xang = 0, float $angs = 0, float $angf = 360, bool $pie = false, int $nc = 2, bool $startpoint = true, bool $ccw = true, bool $svg = false)

Append an elliptical arc to the current path.

from  TCPDF
Circle(float $x0, float $y0, float $r, float $angstr = 0, float $angend = 360, string $style = '', array $line_style = array(), array $fill_color = array(), int $nc = 2)

Draws a circle.

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

Draws a polygonal line

from  TCPDF
Polygon(array $p, string $style = '', array $line_style = array(), array $fill_color = array(), bool $closed = true)

Draws a polygon.

from  TCPDF
RegularPolygon(float $x0, float $y0, float $r, int $ns, float $angle = 0, bool $draw_circle = false, string $style = '', array $line_style = array(), array $fill_color = array(), string $circle_style = '', array $circle_outLine_style = array(), array $circle_fill_color = array())

Draws a regular polygon.

from  TCPDF
StarPolygon(float $x0, float $y0, float $r, int $nv, int $ng, float $angle = 0, bool $draw_circle = false, string $style = '', array $line_style = array(), array $fill_color = array(), string $circle_style = '', array $circle_outLine_style = array(), array $circle_fill_color = array())

Draws a star polygon

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

Draws a rounded rectangle.

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

Draws a rounded rectangle.

from  TCPDF
Arrow(float $x0, float $y0, float $x1, float $y1, int $head_style = 0, float $arm_size = 5, int $arm_angle = 15)

Draws a grahic arrow.

from  TCPDF
string|false
setDestination(string $name, float $y = -1, int|string $page = '', float $x = -1)

Add a Named Destination.

from  TCPDF
array
getDestination()

Return the Named Destination array.

from  TCPDF
_putdests()

Insert Named Destinations.

from  TCPDF
setBookmark(string $txt, int $level = 0, float $y = -1, int|string $page = '', string $style = '', array $color = array(0, 0, 0), float $x = -1, mixed $link = '')

Adds a bookmark - alias for Bookmark().

from  TCPDF
Bookmark(string $txt, int $level = 0, float $y = -1, int|string $page = '', string $style = '', array $color = array(0, 0, 0), float $x = -1, mixed $link = '')

Adds a bookmark.

from  TCPDF
sortBookmarks()

Sort bookmarks for page and key.

from  TCPDF
_putbookmarks()

Create a bookmark PDF string.

from  TCPDF
IncludeJS(string $script)

Adds a javascript

from  TCPDF
int
addJavascriptObject(string $script, bool $onload = false)

Adds a javascript object and return object ID

from  TCPDF
_putjavascript()

Create a javascript PDF string.

from  TCPDF
_addfield(string $type, string $name, int $x, int $y, int $w, int $h, array $prop)

Adds a javascript form field.

from  TCPDF
setFormDefaultProp(array $prop = array())

Set default properties for form fields.

from  TCPDF
array
getFormDefaultProp()

Return the default properties for form fields.

from  TCPDF
TextField(string $name, float $w, float $h, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)

Creates a text field

from  TCPDF
RadioButton(string $name, int $w, array $prop = array(), array $opt = array(), string $onvalue = 'On', bool $checked = false, float|null $x = null, float|null $y = null, bool $js = false)

Creates a RadioButton field.

from  TCPDF
ListBox(string $name, int $w, int $h, array $values, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)

Creates a List-box field

from  TCPDF
ComboBox(string $name, int $w, int $h, array $values, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)

Creates a Combo-box field

from  TCPDF
CheckBox(string $name, int $w, bool $checked = false, array $prop = array(), array $opt = array(), string $onvalue = 'Yes', float|null $x = null, float|null $y = null, bool $js = false)

Creates a CheckBox field

from  TCPDF
Button(string $name, int $w, int $h, string $caption, mixed $action, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)

Creates a button field

from  TCPDF
_putsignature()

Add certification signature (DocMDP or UR3) You can set only one signature type

from  TCPDF
setUserRights(bool $enable = true, string $document = '/FullSave', string $annots = '/Create/Delete/Modify/Copy/Import/Export', string $form = '/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate', string $signature = '/Modify', string $ef = '/Create/Delete/Modify/Import', string $formex = '')

Set User's Rights for PDF Reader WARNING: This is experimental and currently do not work.

from  TCPDF
setSignature(mixed $signing_cert = '', mixed $private_key = '', string $private_key_password = '', string $extracerts = '', int $cert_type = 2, array $info = array(), string $approval = '')

Enable document signature (requires the OpenSSL Library).

from  TCPDF
setSignatureAppearance(float $x = 0, float $y = 0, float $w = 0, float $h = 0, int $page = -1, string $name = '')

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

from  TCPDF
addEmptySignatureAppearance(float $x = 0, float $y = 0, float $w = 0, float $h = 0, int $page = -1, string $name = '')

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

from  TCPDF
array
getSignatureAppearanceArray(float $x = 0, float $y = 0, float $w = 0, float $h = 0, int $page = -1, string $name = '')

Get the array that defines the signature appearance (page and rectangle coordinates).

from  TCPDF
setTimeStamp(string $tsa_host = '', string $tsa_username = '', string $tsa_password = '', string $tsa_cert = '')

Enable document timestamping (requires the OpenSSL Library).

from  TCPDF
string
applyTSA(string $signature)

NOT YET IMPLEMENTED Request TSA for a timestamp

from  TCPDF
startPageGroup(int|null $page = null)

Create a new page group.

from  TCPDF
setStartingPageNumber(int $num = 1)

Set the starting page number.

from  TCPDF
string
getAliasRightShift()

Returns the string alias used right align page numbers.

from  TCPDF
string
getAliasNbPages()

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

from  TCPDF
string
getAliasNumPage()

Returns the string alias used for the page number.

from  TCPDF
string
getPageGroupAlias()

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

from  TCPDF
string
getPageNumGroupAlias()

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

from  TCPDF
int
getGroupPageNo()

Return the current page in the group.

from  TCPDF
getGroupPageNoFormatted()

Returns the current group page number formatted as a string.

from  TCPDF
PageNoFormatted()

Returns the current page number formatted as a string.

from  TCPDF
_putocg()

Put pdf layers.

from  TCPDF
startLayer(string $name = '', bool|null $print = true, bool $view = true, bool $lock = true)

Start a new pdf layer.

from  TCPDF
endLayer()

End the current PDF layer.

from  TCPDF
setVisibility(string $v)

Set the visibility of the successive elements.

from  TCPDF
int|void
addExtGState(array $parms)

Add transparency parameters to the current extgstate

from  TCPDF
setExtGState(int $gs)

Add an extgstate

from  TCPDF
_putextgstates()

Put extgstates for object transparency

from  TCPDF
setOverprint(bool $stroking = true, bool|null $nonstroking = null, int $mode = 0)

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

from  TCPDF
array<string,bool|int>
getOverprint()

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

from  TCPDF
setAlpha(float $stroking = 1, string $bm = 'Normal', float|null $nonstroking = null, bool $ais = false)

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

from  TCPDF
array<string,bool|string>
getAlpha()

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

from  TCPDF
setJPEGQuality(int $quality)

Set the default JPEG compression quality (1-100)

from  TCPDF
setDefaultTableColumns(int $cols = 4)

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

from  TCPDF
setCellHeightRatio(float $h)

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

from  TCPDF
float
getCellHeightRatio()

return the height of cell repect font height.

from  TCPDF
setPDFVersion(string $version = '1.7')

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

from  TCPDF
setViewerPreferences(array $preferences)

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

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

Paints color transition registration bars

from  TCPDF
cropMark(float $x, float $y, float $w, float $h, string $type = 'T,R,B,L', array $color = array(100, 100, 100, 100, 'All'))

Paints crop marks.

from  TCPDF
registrationMark(float $x, float $y, float $r, bool $double = false, array $cola = array(100, 100, 100, 100, 'All'), array $colb = array(0, 0, 0, 0, 'None'))

Paints a registration mark

from  TCPDF
registrationMarkCMYK(float $x, float $y, float $r)

Paints a CMYK registration mark

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

Paints a linear colour gradient.

from  TCPDF
RadialGradient(float $x, float $y, float $w, float $h, array $col1 = array(), array $col2 = array(), array $coords = array(0.5, 0.5, 0.5, 0.5, 1))

Paints a radial colour gradient.

from  TCPDF
CoonsPatchMesh(float $x, float $y, float $w, float $h, array $col1 = array(), array $col2 = array(), array $col3 = array(), array $col4 = array(), 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), array $coords_min = 0, array $coords_max = 1, bool $antialias = false)

Paints a coons patch mesh.

from  TCPDF
Clip(float $x, float $y, float $w, float $h)

Set a rectangular clipping area.

from  TCPDF
Gradient(int $type, array $coords, array $stops, array $background = array(), bool $antialias = false)

Output gradient.

from  TCPDF
_putshaders()

Output gradient shaders.

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

Draw the sector of a circle.

from  TCPDF
PieSectorXY(float $xc, float $yc, float $rx, float $ry, float $a, float $b, string $style = 'FD', float $cw = false, float $o = 0, int $nc = 2)

Draw the sector of an ellipse.

from  TCPDF
ImageEps(string $file, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, mixed $link = '', bool $useBoundingBox = true, string $align = '', string $palign = '', mixed $border = 0, bool $fitonpage = false, bool $fixoutvals = false)

Embed vector-based Adobe Illustrator (AI) or AI-compatible EPS files.

from  TCPDF
setBarcode(string $bc = '')

Set document barcode.

from  TCPDF
string
getBarcode()

Get current barcode.

from  TCPDF
write1DBarcode(string $code, string $type, float|null $x = null, float|null $y = null, float|null $w = null, float|null $h = null, float|null $xres = null, array $style = array(), string $align = '')

Print a Linear Barcode.

from  TCPDF
write2DBarcode(string $code, string $type, float|null $x = null, float|null $y = null, float|null $w = null, float|null $h = null, array $style = array(), string $align = '', bool $distort = false)

Print 2D Barcode.

from  TCPDF
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

from  TCPDF
array
getOriginalMargins()

Returns an array containing original margins:

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

from  TCPDF
float
getFontSize()

Returns the current font size.

from  TCPDF
int
getFontSizePt()

Returns the current font size in points unit.

from  TCPDF
string
getFontFamily()

Returns the current font family name.

from  TCPDF
string
getFontStyle()

Returns the current font style.

from  TCPDF
string
fixHTMLCode(string $html, string $default_css = '', array|null $tagvs = null, array|null $tidy_options = null)

Cleanup HTML code (requires HTML Tidy library).

from  TCPDF
int
getCSSBorderWidth(string $width)

Returns the border width from CSS property

from  TCPDF
int
getCSSBorderDashStyle(string $style)

Returns the border dash style from CSS property

from  TCPDF
array
getCSSBorderStyle(string $cssborder)

Returns the border style array from CSS border properties

from  TCPDF
array
getCSSPadding(string $csspadding, float $width = 0)

Get the internal Cell padding from CSS attribute.

from  TCPDF
array
getCSSMargin(string $cssmargin, float $width = 0)

Get the internal Cell margin from CSS attribute.

from  TCPDF
array
getCSSBorderMargin(string $cssbspace, float $width = 0)

Get the border-spacing from CSS attribute.

from  TCPDF
float
getCSSFontSpacing(string $spacing, float $parent = 0)

Returns the letter-spacing value from CSS value

from  TCPDF
float
getCSSFontStretching(string $stretch, float $parent = 100)

Returns the percentage of font stretching from CSS value

from  TCPDF
float
getHTMLFontUnits(string $val, float $refsize = 12, float $parent_size = 12, string $defaultunit = 'pt')

Convert HTML string containing font size value to points

from  TCPDF
array
getHtmlDomArray(string $html)

Returns the HTML DOM array.

from  TCPDF
string
getSpaceString()

Returns the string used to find spaces

from  TCPDF
string
hashTCPDFtag(string $data)

Calculates the hash value of the given data.

from  TCPDF
string
serializeTCPDFtag(string $method, array $params = array())

Serialize data to be used with TCPDF tag in HTML code.

from  TCPDF
array
unserializeTCPDFtag(string $data)

Unserialize data to be used with TCPDF tag in HTML code.

from  TCPDF
bool
allowedTCPDFtag(string $method)

Check if a TCPDF tag is allowed

from  TCPDF
writeHTMLCell(float $w, float $h, float|null $x, float|null $y, string $html = '', mixed $border = 0, int $ln = 0, bool $fill = false, bool $reseth = true, string $align = '', bool $autopadding = true)

Prints a cell (rectangular area) with optional borders, background color and html text string.

from  TCPDF
writeHTML(string $html, bool $ln = true, bool $fill = false, bool $reseth = false, bool $cell = false, string $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.

from  TCPDF
array
openHTMLTagHandler(array $dom, int $key, bool $cell)

Process opening tags.

from  TCPDF
array
closeHTMLTagHandler(array $dom, int $key, bool $cell, int $maxbottomliney = 0)

Process closing tags.

from  TCPDF
addHTMLVertSpace(string $hbz = 0, string $hb = 0, bool $cell = false, bool $firsttag = false, bool $lasttag = false)

Add vertical spaces if needed.

from  TCPDF
array
getBorderStartPosition()

Return the starting coordinates to draw an html border

from  TCPDF
drawHTMLTagBorder(array $tag, int $xmax)

Draw an HTML block border and fill

from  TCPDF
setLIsymbol(string $symbol = '!')

Set the default bullet to be used as LI bullet symbol

from  TCPDF
setBooklet(bool $booklet = true, float $inner = -1, float $outer = -1)

Set the booklet mode for double-sided pages.

from  TCPDF
swapMargins(bool $reverse = true)

Swap the left and right margins.

from  TCPDF
setHtmlVSpace(array $tagvs)

Set the vertical spaces for HTML tags.

from  TCPDF
setListIndentWidth(float $width)

Set custom width for list indentation.

from  TCPDF
setOpenCell(bool $isopen)

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

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

Set the color and font style for HTML links.

from  TCPDF
float
getHTMLUnitToUnits(string $htmlval, string $refsize = 1, string $defaultunit = 'px', bool $points = false)

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

from  TCPDF
putHtmlListBullet(int $listdepth, string $listtype = '', float $size = 10)

Output an HTML list bullet or ordered item symbol

from  TCPDF
array
getGraphicVars()

Returns current graphic variables as array.

from  TCPDF
setGraphicVars(array $gvars, bool $extended = false)

Set graphic variables.

from  TCPDF
_outSaveGraphicsState()

Outputs the "save graphics state" operator 'q'

from  TCPDF
_outRestoreGraphicsState()

Outputs the "restore graphics state" operator 'Q'

from  TCPDF
setBuffer(string $data)

Set buffer content (always append data).

from  TCPDF
replaceBuffer(string $data)

Replace the buffer content

from  TCPDF
string
getBuffer()

Get buffer content.

from  TCPDF
setPageBuffer(int $page, string $data, bool $append = false)

Set page buffer content.

from  TCPDF
string
getPageBuffer(int $page)

Get page buffer content.

from  TCPDF
int
setImageBuffer(string $image, array $data)

Set image buffer content.

from  TCPDF
setImageSubBuffer(string $image, string $key, array $data)

Set image buffer content for a specified sub-key.

from  TCPDF
string|false
getImageBuffer(string $image)

Get image buffer content.

from  TCPDF
setFontBuffer(string $font, array $data)

Set font buffer content.

from  TCPDF
setFontSubBuffer(string $font, string $key, mixed $data)

Set font buffer content.

from  TCPDF
string|false
getFontBuffer(string $font)

Get font buffer content.

from  TCPDF
bool
movePage(int $frompage, int $topage)

Move a page to a previous position.

from  TCPDF
bool
deletePage(int $page)

Remove the specified page.

from  TCPDF
bool
copyPage(int $page = 0)

Clone the specified page to a new page.

from  TCPDF
addTOC(int|null $page = null, string $numbersfont = '', string $filler = '.', string $toc_name = 'TOC', string $style = '', array $color = array(0, 0, 0))

Output a Table of Content Index (TOC).

from  TCPDF
addHTMLTOC(int|null $page = null, string $toc_name = 'TOC', array $templates = array(), bool $correct_align = true, string $style = '', array $color = array(0, 0, 0))

Output a Table Of Content Index (TOC) using HTML templates.

from  TCPDF
startTransaction()

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

from  TCPDF
commitTransaction()

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

from  TCPDF
rollbackTransaction(bool $self = false)

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

from  TCPDF
setEqualColumns(int $numcols = 0, int $width = 0, int|null $y = null)

Set multiple columns of the same size

from  TCPDF
resetColumns()

Remove columns and reset page margins.

from  TCPDF
setColumnsArray(array $columns)

Set columns array.

from  TCPDF
selectColumn(int|null $col = null)

Set position at a given column

from  TCPDF
int
getColumn()

Return the current column number

from  TCPDF
int
getNumberOfColumns()

Return the current number of columns.

from  TCPDF
setTextRenderingMode(int $stroke = 0, bool $fill = true, bool $clip = false)

Set Text rendering mode.

from  TCPDF
setTextShadow(array $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.

from  TCPDF
array
getTextShadow()

Return the text shadow parameters array.

from  TCPDF
array
hyphenateWord(array $word, array $patterns, array $dictionary = array(), int $leftmin = 1, int $rightmin = 2, int $charmin = 1, int $charmax = 8)

Returns an array of chars containing soft hyphens.

from  TCPDF
string
hyphenateText(string $text, mixed $patterns, array $dictionary = array(), int $leftmin = 1, int $rightmin = 2, int $charmin = 1, int $charmax = 8)

Returns text with soft hyphens.

from  TCPDF
setRasterizeVectorImages(bool $mode)

Enable/disable rasterization of vector images using ImageMagick library.

from  TCPDF
setFontSubsetting(bool $enable = true)

Enable or disable default option for font subsetting.

from  TCPDF
bool
getFontSubsetting()

Return the default option for font subsetting.

from  TCPDF
string
stringLeftTrim(string $str, string $replace = '')

Left trim the input string

from  TCPDF
string
stringRightTrim(string $str, string $replace = '')

Right trim the input string

from  TCPDF
string
stringTrim(string $str, string $replace = '')

Trim the input string

from  TCPDF
bool
isUnicodeFont()

Return true if the current font is unicode type.

from  TCPDF
string
getFontFamilyName(string $fontfamily)

Return normalized font name

from  TCPDF
string|false
startTemplate(int $w = 0, int $h = 0, mixed $group = false)

Start a new XObject Template.

from  TCPDF
string|false
endTemplate()

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

from  TCPDF
printTemplate(string $id, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, string $align = '', string $palign = '', bool $fitonpage = false)

Print an XObject Template.

from  TCPDF
setFontStretching(int $perc = 100)

Set the percentage of character stretching.

from  TCPDF
float
getFontStretching()

Get the percentage of character stretching.

from  TCPDF
setFontSpacing(float $spacing = 0)

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

from  TCPDF
int
getFontSpacing()

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

from  TCPDF
array
getPageRegions()

Return an array of no-write page regions

from  TCPDF
setPageRegions(array $regions = array())

Set no-write regions on page.

from  TCPDF
addPageRegion(array $region)

Add a single no-write region on selected page.

from  TCPDF
removePageRegion(int $key)

Remove a single no-write region.

from  TCPDF
float[]
checkPageRegions(float $h, float $x, float $y)

Check page for no-write regions and adapt current coordinates and page margins if necessary.

from  TCPDF
ImageSVG(string $file, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, mixed $link = '', string $align = '', string $palign = '', mixed $border = 0, bool $fitonpage = false)

Embedd a Scalable Vector Graphics (SVG) image.

from  TCPDF
array
convertSVGtMatrix(array $tm)

Convert SVG transformation matrix to PDF.

from  TCPDF
SVGTransform(array $tm)

Apply SVG graphic transformation matrix.

from  TCPDF
string
setSVGStyles(array $svgstyle, array $prevsvgstyle, int $x = 0, int $y = 0, int $w = 1, int $h = 1, string $clip_function = '', array $clip_params = array())

Apply the requested SVG styles ( TO BE COMPLETED )

from  TCPDF
array
SVGPath(string $d, string $style = '')

Draws an SVG path

from  TCPDF
removeTagNamespace(string $name)

Return the tag name without the namespace

from  TCPDF
startSVGElementHandler(resource|string $parser, string $name, array $attribs, array $ctm = array())

Sets the opening SVG element handler function for the XML parser. ( TO BE COMPLETED )

from  TCPDF
endSVGElementHandler(resource|string $parser, string $name)

Sets the closing SVG element handler function for the XML parser.

from  TCPDF
segSVGContentHandler(resource $parser, string $data)

Sets the character data handler function for the XML parser.

from  TCPDF
string
getCachedFileContents(string $file)

Keeps files in memory, so it doesn't need to downloaded everytime in a loop

from  TCPDF
bool
fileExists(string $file)

Avoid multiple calls to an external server to see if a file exists

from  TCPDF
void
importPDF(string $filename)

Import an existing PDF document

Details

__construct(string $orientation = 'P', string $unit = 'mm', mixed $format = 'A4', bool $unicode = true, string $encoding = 'UTF-8', bool $diskcache = false, false|int $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

string $orientation

page orientation. Possible values are (case insensitive):

  • P or Portrait (default)
  • L or Landscape
  • '' (empty string) for automatic orientation

string $unit

User measure unit. Possible values are:

  • pt: point
  • mm: millimeter (default)
  • cm: centimeter
  • in: inch

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

mixed $format

The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().

bool $unicode

TRUE means that the input text is unicode (default = true)

string $encoding

Charset encoding (used only when converting back html entities); default is UTF-8.

bool $diskcache

DEPRECATED FEATURE

false|int $pdfa

If not false, set the document to PDF/A mode and the good version (1 or 3).

See also

getPageSizeFromFormat()
setPageFormat()

__destruct()

Since: 1.53.0.TC016

Default destructor.

setPageUnit(string $unit)

Since: 3.0.015 (2008-06-06)

Set the units of measure for the document.

Parameters

string $unit

User measure unit. Possible values are:

  • pt: point
  • mm: millimeter (default)
  • cm: centimeter
  • in: inch

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

protected setPageFormat(mixed $format, string $orientation = 'P')

Since: 3.0.015 (2008-06-06)

Change the format of the current page

Parameters

mixed $format

The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() documentation or an array of two numbers (width, height) or an array containing the following measures and options:

  • ['format'] = page format name (one of the above);
  • ['Rotate'] : The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
  • ['PZ'] : The page's preferred zoom (magnification) factor.
  • ['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed:
  • ['MediaBox']['llx'] : lower-left x coordinate
  • ['MediaBox']['lly'] : lower-left y coordinate
  • ['MediaBox']['urx'] : upper-right x coordinate
  • ['MediaBox']['ury'] : upper-right y coordinate
  • ['CropBox'] : the visible region of default user space:
  • ['CropBox']['llx'] : lower-left x coordinate
  • ['CropBox']['lly'] : lower-left y coordinate
  • ['CropBox']['urx'] : upper-right x coordinate
  • ['CropBox']['ury'] : upper-right y coordinate
  • ['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment:
  • ['BleedBox']['llx'] : lower-left x coordinate
  • ['BleedBox']['lly'] : lower-left y coordinate
  • ['BleedBox']['urx'] : upper-right x coordinate
  • ['BleedBox']['ury'] : upper-right y coordinate
  • ['TrimBox'] : the intended dimensions of the finished page after trimming:
  • ['TrimBox']['llx'] : lower-left x coordinate
  • ['TrimBox']['lly'] : lower-left y coordinate
  • ['TrimBox']['urx'] : upper-right x coordinate
  • ['TrimBox']['ury'] : upper-right y coordinate
  • ['ArtBox'] : the extent of the page's meaningful content:
  • ['ArtBox']['llx'] : lower-left x coordinate
  • ['ArtBox']['lly'] : lower-left y coordinate
  • ['ArtBox']['urx'] : upper-right x coordinate
  • ['ArtBox']['ury'] : upper-right y coordinate
  • ['BoxColorInfo'] :specify the colours and other visual characteristics that should be used in displaying guidelines on the screen for each of the possible page boundaries other than the MediaBox:
  • ['BoxColorInfo'][BOXTYPE]['C'] : an array of three numbers in the range 0-255, representing the components in the DeviceRGB colour space.
  • ['BoxColorInfo'][BOXTYPE]['W'] : the guideline width in default user units
  • ['BoxColorInfo'][BOXTYPE]['S'] : the guideline style: S = Solid; D = Dashed
  • ['BoxColorInfo'][BOXTYPE]['D'] : dash array defining a pattern of dashes and gaps to be used in drawing dashed guidelines
  • ['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
  • ['trans']['Dur'] : The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
  • ['trans']['S'] : transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
  • ['trans']['D'] : The duration of the transition effect, in seconds.
  • ['trans']['Dm'] : (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
  • ['trans']['M'] : (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
  • ['trans']['Di'] : (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
  • ['trans']['SS'] : (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
  • ['trans']['B'] : (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.

string $orientation

page orientation. Possible values are (case insensitive):

  • P or Portrait (default)
  • L or Landscape
  • '' (empty string) for automatic orientation

See also

getPageSizeFromFormat()

setPageOrientation(string $orientation, bool|null $autopagebreak = null, float|null $bottommargin = null)

Since: 3.0.015 (2008-06-06)

Set page orientation.

Parameters

string $orientation

page orientation. Possible values are (case insensitive):

  • P or Portrait (default)
  • L or Landscape
  • '' (empty string) for automatic orientation

bool|null $autopagebreak

Boolean indicating if auto-page-break mode should be on or off.

float|null $bottommargin

bottom margin of the page.

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

Since: 4.6.016 (2009-06-15)

Set regular expression to detect withespaces or word separators.

The pattern delimiter must be the forward-slash character "/". Some example patterns are:

Non-Unicode or missing PCRE unicode support: "/[^\S\xa0]/"
Unicode and PCRE unicode support: "/(?!\xa0)[\s\p{Z}]/u"
Unicode and PCRE unicode support in Chinese mode: "/(?!\xa0)[\s\p{Z}\p{Lo}]/u"
if PCRE unicode support is turned ON ("\P" is the negate class of "\p"):
     \s     : any whitespace character
     \p{Z}  : any separator
     \p{Lo} : Unicode letter or ideograph that does not have lowercase and uppercase variants. Is used to chunk chinese words.
     \xa0   : Unicode Character 'NO-BREAK SPACE' (U+00A0)

Parameters

string $re

regular expression (leave empty for default).

setRTL(bool $enable, bool $resetx = true)

Since: 2.0.000 (2008-01-03)

Enable or disable Right-To-Left language mode

Parameters

bool $enable

if true enable Right-To-Left language mode.

bool $resetx

if true reset the X position on direction change.

bool getRTL()

Since: 4.0.012 (2008-07-24)

Return the RTL status

Return Value

bool

setTempRTL(false|string $mode)

Since: 2.1.000 (2008-01-09)

Force temporary RTL language direction

Parameters

false|string $mode

can be false, 'L' for LTR or 'R' for RTL

bool isRTLTextDir()

Since: 4.8.014 (2009-11-04)

Return the current temporary RTL status

Return Value

bool

setLastH(float $h)

Since: 1.53.0.TC034

Set the last cell height.

Parameters

float $h

cell height.

float getCellHeight(int $fontsize, bool $padding = TRUE)

Return the cell height

Parameters

int $fontsize

Font size in internal units

bool $padding

If true add cell padding

Return Value

float

resetLastH()

Since: 5.9.000 (2010-10-03)

Reset the last cell height.

float getLastH()

Since: 4.0.017 (2008-08-05)

Get the last cell height.

Return Value

float

last cell height

setImageScale(float $scale)

Since: 1.5.2

Set the adjusting factor to convert pixels to user units.

Parameters

float $scale

adjusting factor to convert pixels to user units.

float getImageScale()

Since: 1.5.2

Returns the adjusting factor to convert pixels to user units.

Return Value

float

adjusting factor to convert pixels to user units.

array getPageDimensions(int|null $pagenum = null)

Since: 4.5.027 (2009-03-16)

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

int|null $pagenum

page number (empty = current page)

Return Value

array

of page dimensions.

int|float getPageWidth(int|null $pagenum = null)

Since: 1.5.2

Returns the page width in units.

Parameters

int|null $pagenum

page number (empty = current page)

Return Value

int|float

page width.

See also

getPageDimensions()

int|float getPageHeight(int|null $pagenum = null)

Since: 1.5.2

Returns the page height in units.

Parameters

int|null $pagenum

page number (empty = current page)

Return Value

int|float

page height.

See also

getPageDimensions()

int|float getBreakMargin(int|null $pagenum = null)

Since: 1.5.2

Returns the page break margin.

Parameters

int|null $pagenum

page number (empty = current page)

Return Value

int|float

page break margin.

See also

getPageDimensions()

int getScaleFactor()

Since: 1.5.2

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

Return Value

int

scale factor.

setMargins(int|float $left, int|float $top, int|float|null $right = null, bool $keepmargins = false)

Since: 1.0

Defines the left, top and right margins.

Parameters

int|float $left

Left margin.

int|float $top

Top margin.

int|float|null $right

Right margin. Default value is the left one.

bool $keepmargins

if true overwrites the default page margins

See also

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

setLeftMargin(int|float $margin)

Since: 1.4

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

int|float $margin

The margin.

See also

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

setTopMargin(int|float $margin)

Since: 1.5

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

Parameters

int|float $margin

The margin.

See also

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

setRightMargin(int|float $margin)

Since: 1.5

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

Parameters

int|float $margin

The margin.

See also

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

setCellPadding(int|float $pad)

Since: 2.1.000 (2008-01-09)

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

Parameters

int|float $pad

internal padding.

See also

getCellPaddings()
setCellPaddings()

setCellPaddings(int|float|null $left = null, int|float|null $top = null, int|float|null $right = null, int|float|null $bottom = null)

Since: 5.9.000 (2010-10-03)

Set the internal Cell paddings.

Parameters

int|float|null $left

left padding

int|float|null $top

top padding

int|float|null $right

right padding

int|float|null $bottom

bottom padding

See also

getCellPaddings()
SetCellPadding()

array getCellPaddings()

Since: 5.9.000 (2010-10-03)

Get the internal Cell padding array.

Return Value

array

of padding values

See also

setCellPaddings()
SetCellPadding()

setCellMargins(int|float|null $left = null, int|float|null $top = null, int|float|null $right = null, int|float|null $bottom = null)

Since: 5.9.000 (2010-10-03)

Set the internal Cell margins.

Parameters

int|float|null $left

left margin

int|float|null $top

top margin

int|float|null $right

right margin

int|float|null $bottom

bottom margin

See also

getCellMargins()

array getCellMargins()

Since: 5.9.000 (2010-10-03)

Get the internal Cell margin array.

Return Value

array

of margin values

See also

setCellMargins()

protected void|array adjustCellPadding(string|array|int|bool $brd = 0)

Since: 5.9.000 (2010-10-03)

Adjust the internal Cell padding array to take account of the line width.

Parameters

string|array|int|bool $brd

Indicates if borders must be drawn around the cell. The value can be a number:

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

Return Value

void|array

array of adjustments

setAutoPageBreak(bool $auto, float $margin = 0)

Since: 1.0

Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.

Parameters

bool $auto

Boolean indicating if mode should be on or off.

float $margin

Distance from the bottom of the page.

See also

Cell()
MultiCell()
AcceptPageBreak()

bool getAutoPageBreak()

Since: 5.9.088

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

Return Value

bool

auto-page-break mode

setDisplayMode(mixed $zoom, string $layout = 'SinglePage', string $mode = 'UseNone')

Since: 1.2

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

Parameters

mixed $zoom

The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.

  • fullpage: displays the entire page on screen
  • fullwidth: uses maximum width of window
  • real: uses real size (equivalent to 100% zoom)
  • default: uses viewer default mode

string $layout

The page layout. Possible values are:

  • SinglePage Display one page at a time
  • OneColumn Display the pages in one column
  • TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
  • TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
  • TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left
  • TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right

string $mode

A name object specifying how the document should be displayed when opened:

  • UseNone Neither document outline nor thumbnail images visible
  • UseOutlines Document outline visible
  • UseThumbs Thumbnail images visible
  • FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible
  • UseOC (PDF 1.5) Optional content group panel visible
  • UseAttachments (PDF 1.6) Attachments panel visible

setCompression(bool $compress = true)

Since: 1.4

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

bool $compress

Boolean indicating if compression must be enabled.

setSRGBmode(bool $mode = false)

Since: 5.9.121 (2011-09-28)

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

Parameters

bool $mode

If true force sRGB output intent.

setDocInfoUnicode(bool $unicode = true)

Since: 5.9.027 (2010-12-01)

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

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

Parameters

bool $unicode

if true set the meta information in Unicode

setTitle(string $title)

Since: 1.2

Defines the title of the document.

Parameters

string $title

The title.

See also

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

setSubject(string $subject)

Since: 1.2

Defines the subject of the document.

Parameters

string $subject

The subject.

See also

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

setAuthor(string $author)

Since: 1.2

Defines the author of the document.

Parameters

string $author

The name of the author.

See also

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

setKeywords(string $keywords)

Since: 1.2

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

Parameters

string $keywords

The list of keywords.

See also

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

setCreator(string $creator)

Since: 1.2

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

Parameters

string $creator

The name of the creator.

See also

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

setAllowLocalFiles(bool $allowLocalFiles)

Since: 6.4

Whether to allow local file path in image html tags, when prefixed with file://

Parameters

bool $allowLocalFiles

true, when local files should be allowed. Otherwise false.

Error(string $msg)

Since: 1.0

Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.

Parameters

string $msg

The error message

Open()

Since: 1.0

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

Close()

Since: 1.0

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

setPage(int $pnum, bool $resetmargins = false)

Since: 2.1.000 (2008-01-07)

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

Parameters

int $pnum

page number (1 ... numpages)

bool $resetmargins

if true reset left, right, top margins and Y position.

See also

getPage()
lastpage()
getNumPages()

lastPage(bool $resetmargins = false)

Since: 2.0.000 (2008-01-04)

Reset pointer to the last document page.

Parameters

bool $resetmargins

if true reset left, right, top margins and Y position.

See also

setPage()
getPage()
getNumPages()

int getPage()

Since: 2.1.000 (2008-01-07)

Get current document page number.

Return Value

int

page number

See also

setPage()
lastpage()
getNumPages()

int getNumPages()

Since: 2.1.000 (2008-01-07)

Get the total number of insered pages.

Return Value

int

number of pages

See also

setPage()
getPage()
lastpage()

addTOCPage(string $orientation = '', mixed $format = '', bool $keepmargins = false)

Since: 5.0.001 (2010-05-06)

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

Parameters

string $orientation

page orientation.

mixed $format

The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().

bool $keepmargins

if true overwrites the default page margins with the current margins

See also

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

endTOCPage()

Since: 5.0.001 (2010-05-06)

Terminate the current TOC (Table Of Content) page

See also

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

AddPage(string $orientation = '', mixed $format = '', bool $keepmargins = false, bool $tocpage = false)

Since: 1.0

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

string $orientation

page orientation. Possible values are (case insensitive):

  • P or PORTRAIT (default)
  • L or LANDSCAPE

mixed $format

The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().

bool $keepmargins

if true overwrites the default page margins with the current margins

bool $tocpage

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

endPage(bool $tocpage = false)

Since: 4.2.010 (2008-11-14)

Terminate the current page

Parameters

bool $tocpage

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

See also

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

startPage(string $orientation = '', mixed $format = '', bool $tocpage = false)

Since: 4.2.010 (2008-11-14)

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

string $orientation

page orientation. Possible values are (case insensitive):

  • P or PORTRAIT (default)
  • L or LANDSCAPE

mixed $format

The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().

bool $tocpage

if true the page is designated to contain the Table-Of-Content.

See also

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

setPageMark()

Since: 4.0.016 (2008-07-30)

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.

protected setContentMark(int $page = 0)

Since: 4.6.021 (2009-07-20)

Set start-writing mark on selected page.

Borders and fills are always created after content and inserted on the position marked by this method.

Parameters

int $page

page number (default is the current page)

setHeaderData(string $ln = '', int $lw = 0, string $ht = '', string $hs = '', int[] $tc = array(0, 0, 0), int[] $lc = array(0, 0, 0))

Set header data.

Parameters

string $ln

header image logo

int $lw

header image logo width in mm

string $ht

string to print as title on document header

string $hs

string to print on document header

int[] $tc

RGB array color for text.

int[] $lc

RGB array color for line.

setFooterData(int[] $tc = array(0, 0, 0), int[] $lc = array(0, 0, 0))

Set footer data.

Parameters

int[] $tc

RGB array color for text.

int[] $lc

RGB array color for line.

array<string,mixed> getHeaderData()

Since: 4.0.012 (2008-07-24)

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<string,mixed>

setHeaderMargin(float $hm = 10)

Set header margin.

(minimum distance between header and top page margin)

Parameters

float $hm

distance in user units

float getHeaderMargin()

Since: 4.0.012 (2008-07-24)

Returns header margin in user units.

Return Value

float

setFooterMargin(float $fm = 10)

Set footer margin.

(minimum distance between footer and bottom page margin)

Parameters

float $fm

distance in user units

float getFooterMargin()

Since: 4.0.012 (2008-07-24)

Returns footer margin in user units.

Return Value

float

setPrintHeader(bool $val = true)

Set a flag to print page header.

Parameters

bool $val

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

setPrintFooter(bool $val = true)

Set a flag to print page footer.

Parameters

bool $val

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

float getImageRBX()

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

Return Value

float

float getImageRBY()

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

Return Value

float

resetHeaderTemplate()

Reset the xobject template used by Header() method.

setHeaderTemplateAutoreset(bool $val = true)

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

Parameters

bool $val

set to true to reset Header xobject template at each page, false otherwise.

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.

protected setHeader()

Since: 4.0.012 (2008-07-24)

This method is used to render the page header.

protected setFooter()

Since: 4.0.012 (2008-07-24)

This method is used to render the page footer.

protected bool inPageBody()

Since: 5.9.091 (2011-06-15)

Check if we are on the page body (excluding page header and footer).

Return Value

bool

true if we are not in page header nor in page footer, false otherwise.

protected setTableHeader()

Since: 4.5.030 (2009-03-25)

This method is used to render the table header on new page (if any).

int PageNo()

Since: 1.0

Returns the current page number.

Return Value

int

page number

See also

getAliasNbPages()

array getAllSpotColors()

Since: 6.0.038 (2013-09-30)

Returns the array of spot colors.

Return Value

array

Spot colors array.

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

Since: 4.0.024 (2008-09-12)

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

string $name

Full name of the spot color.

float $c

Cyan color for CMYK. Value between 0 and 100.

float $m

Magenta color for CMYK. Value between 0 and 100.

float $y

Yellow color for CMYK. Value between 0 and 100.

float $k

Key (Black) color for CMYK. Value between 0 and 100.

See also

SetDrawSpotColor()
SetFillSpotColor()
SetTextSpotColor()

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

Since: 5.9.125 (2011-10-03)

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

Parameters

string $type

Type of object affected by this color: ('draw', 'fill', 'text').

string $name

Name of the spot color.

float $tint

Intensity of the color (from 0 to 100 ; 100 = full intensity by default).

Return Value

string

PDF color command.

setDrawSpotColor(string $name, float $tint = 100)

Since: 4.0.024 (2008-09-12)

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

Parameters

string $name

Name of the spot color.

float $tint

Intensity of the color (from 0 to 100 ; 100 = full intensity by default).

See also

AddSpotColor()
SetFillSpotColor()
SetTextSpotColor()

setFillSpotColor(string $name, float $tint = 100)

Since: 4.0.024 (2008-09-12)

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

Parameters

string $name

Name of the spot color.

float $tint

Intensity of the color (from 0 to 100 ; 100 = full intensity by default).

See also

AddSpotColor()
SetDrawSpotColor()
SetTextSpotColor()

setTextSpotColor(string $name, int $tint = 100)

Since: 4.0.024 (2008-09-12)

Defines the spot color used for text.

Parameters

string $name

Name of the spot color.

int $tint

Intensity of the color (from 0 to 100 ; 100 = full intensity by default).

See also

AddSpotColor()
SetDrawSpotColor()
SetFillSpotColor()

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

Since: 3.1.000 (2008-06-11)

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

string $type

Type of object affected by this color: ('draw', 'fill', 'text').

array $color

Array of colors (1=gray, 3=RGB, 4=CMYK or 5=spotcolor=CMYK+name values).

bool $ret

If true do not send the PDF command.

Return Value

string

The PDF command or empty string.

string setDrawColorArray(array $color, bool $ret = false)

Since: 3.1.000 (2008-06-11)

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

array $color

Array of colors (1, 3 or 4 values).

bool $ret

If true do not send the PDF command.

Return Value

string

the PDF command

See also

SetDrawColor()

setFillColorArray(array $color, bool $ret = false)

Since: 3.1.000 (2008-6-11)

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

array $color

Array of colors (1, 3 or 4 values).

bool $ret

If true do not send the PDF command.

See also

SetFillColor()

setTextColorArray(array $color, bool $ret = false)

Since: 3.1.000 (2008-6-11)

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

array $color

Array of colors (1, 3 or 4 values).

bool $ret

If true do not send the PDF command.

See also

SetFillColor()

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

Since: 5.9.125 (2011-10-03)

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

Parameters

string $type

Type of object affected by this color: ('draw', 'fill', 'text').

float $col1

GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100).

float $col2

GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100).

float $col3

BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100).

float $col4

KEY (BLACK) color for CMYK (0-100).

bool $ret

If true do not send the command.

string $name

spot color name (if any)

Return Value

string

The PDF command or empty string.

string setDrawColor(float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $name = '')

Since: 1.3

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

float $col1

GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100).

float $col2

GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100).

float $col3

BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100).

float $col4

KEY (BLACK) color for CMYK (0-100).

bool $ret

If true do not send the command.

string $name

spot color name (if any)

Return Value

string

the PDF command

See also

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

string setFillColor(float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $name = '')

Since: 1.3

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

float $col1

GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100).

float $col2

GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100).

float $col3

BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100).

float $col4

KEY (BLACK) color for CMYK (0-100).

bool $ret

If true do not send the command.

string $name

Spot color name (if any).

Return Value

string

The PDF command.

See also

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

string setTextColor(float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $name = '')

Since: 1.3

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

float $col1

GRAY level for single color, or Red color for RGB (0-255), or CYAN color for CMYK (0-100).

float $col2

GREEN color for RGB (0-255), or MAGENTA color for CMYK (0-100).

float $col3

BLUE color for RGB (0-255), or YELLOW color for CMYK (0-100).

float $col4

KEY (BLACK) color for CMYK (0-100).

bool $ret

If true do not send the command.

string $name

Spot color name (if any).

Return Value

string

Empty string.

See also

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

float[]|float GetStringWidth(string $s, string $fontname = '', string $fontstyle = '', float $fontsize = 0, bool $getarray = false)

Since: 1.2

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

Parameters

string $s

The string whose length is to be computed

string $fontname

Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained.

string $fontstyle

Font style. Possible values are (case insensitive):

  • empty string: regular
  • B: bold
  • I: italic
  • U: underline
  • D: line-through
  • O: overline
or any combination. The default value is regular.

float $fontsize

Font size in points. The default value is the current size.

bool $getarray

if true returns an array of characters widths, if false returns the total length.

Return Value

float[]|float

total string length or array of characted widths

float[]|float GetArrStringWidth(array $sa, string $fontname = '', string $fontstyle = '', float $fontsize = 0, bool $getarray = false)

Since: 2.4.000 (2008-03-06)

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

Parameters

array $sa

The array of chars whose total length is to be computed

string $fontname

Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained.

string $fontstyle

Font style. Possible values are (case insensitive):

  • empty string: regular
  • B: bold
  • I: italic
  • U: underline
  • D: line through
  • O: overline
or any combination. The default value is regular.

float $fontsize

Font size in points. The default value is the current size.

bool $getarray

if true returns an array of characters widths, if false returns the total length.

Return Value

float[]|float

total string length or array of characted widths

float GetCharWidth(int $char, bool $notlast = true)

Since: 2.4.000 (2008-03-06)

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

Parameters

int $char

The char code whose length is to be returned

bool $notlast

If false ignore the font-spacing.

Return Value

float

char width

float getRawCharWidth(int $char)

Since: 5.9.000 (2010-09-28)

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

Parameters

int $char

The char code whose length is to be returned

Return Value

float

char width

int GetNumChars(string $s)

Since: 2.0.0001 (2008-01-07)

Returns the numbero of characters in a string.

Parameters

string $s

The input string.

Return Value

int

number of characters

protected getFontsList()

Since: 4.0.013 (2008-07-28)

Fill the list of available fonts ($this->fontlist).

array|false AddFont(string $family, string $style = '', string $fontfile = '', mixed $subset = 'default')

Since: 1.5

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

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

Parameters

string $family

Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font.

string $style

Font style. Possible values are (case insensitive):

  • empty string: regular (default)
  • B: bold
  • I: italic
  • BI or IB: bold italic

string $fontfile

The font definition file. By default, the name is built from the family and style, in lower case with no spaces.

mixed $subset

if true embedd only a subset of the font (stores only the information related to the used characters); if false embedd full font; if 'default' uses the default value set using setFontSubsetting(). This option is valid only for TrueTypeUnicode fonts. If you want to enable users to change the document, set this parameter to false. If you subset the font, the person who receives your PDF would need to have your same font in order to make changes to your PDF. The file size of the PDF would also be smaller because you are embedding only part of a font.

Return Value

array|false

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

See also

SetFont()
setFontSubsetting()

setFont(string $family, string $style = '', float|null $size = null, string $fontfile = '', mixed $subset = 'default', bool $out = true)

Since: 1.0

Sets the font used to print character strings.

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

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

Parameters

string $family

Family font. It can be either a name defined by AddFont() or one of the standard Type1 families (case insensitive):

  • times (Times-Roman)
  • timesb (Times-Bold)
  • timesi (Times-Italic)
  • timesbi (Times-BoldItalic)
  • helvetica (Helvetica)
  • helveticab (Helvetica-Bold)
  • helveticai (Helvetica-Oblique)
  • helveticabi (Helvetica-BoldOblique)
  • courier (Courier)
  • courierb (Courier-Bold)
  • courieri (Courier-Oblique)
  • courierbi (Courier-BoldOblique)
  • symbol (Symbol)
  • zapfdingbats (ZapfDingbats)
It is also possible to pass an empty string. In that case, the current family is retained.

string $style

Font style. Possible values are (case insensitive):

  • empty string: regular
  • B: bold
  • I: italic
  • U: underline
  • D: line through
  • O: overline
or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats basic fonts or other fonts when not defined.

float|null $size

Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12

string $fontfile

The font definition file. By default, the name is built from the family and style, in lower case with no spaces.

mixed $subset

if true embedd only a subset of the font (stores only the information related to the used characters); if false embedd full font; if 'default' uses the default value set using setFontSubsetting(). This option is valid only for TrueTypeUnicode fonts. If you want to enable users to change the document, set this parameter to false. If you subset the font, the person who receives your PDF would need to have your same font in order to make changes to your PDF. The file size of the PDF would also be smaller because you are embedding only part of a font.

bool $out

if true output the font size command, otherwise only set the font properties.

See also

AddFont()
SetFontSize()

setFontSize(float $size, bool $out = true)

Since: 1.0

Defines the size of the current font.

Parameters

float $size

The font size in points.

bool $out

if true output the font size command, otherwise only set the font properties.

See also

SetFont()

array getFontBBox()

Since: 5.9.152 (2012-03-23)

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

Return Value

array

float getAbsFontMeasure(int $s)

Since: 5.9.186 (2012-09-13)

Convert a relative font measure into absolute value.

Parameters

int $s

Font measure.

Return Value

float

Absolute measure.

false|array getCharBBox(int $char)

Since: 5.9.186 (2012-09-13)

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

Parameters

int $char

Input character code.

Return Value

false|array

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

int getFontDescent(string $font, string $style = '', float $size = 0)

Since: 4.9.003 (2010-03-30)

Return the font descent value

Parameters

string $font

font name

string $style

font style

float $size

The size (in points)

Return Value

int

font descent

int getFontAscent(string $font, string $style = '', float $size = 0)

Since: 4.9.003 (2010-03-30)

Return the font ascent value.

Parameters

string $font

font name

string $style

font style

float $size

The size (in points)

Return Value

int

font ascent

bool isCharDefined(mixed $char, string $font = '', string $style = '')

Since: 5.9.153 (2012-03-28)

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

Parameters

mixed $char

Character to check (integer value or string)

string $font

Font name (family name).

string $style

Font style.

Return Value

bool

true if the char is defined, false otherwise.

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

Since: 5.9.153 (2012-03-28)

Replace missing font characters on selected font with specified substitutions.

Parameters

string $text

Text to process.

string $font

Font name (family name).

string $style

Font style.

array $subs

Array of possible character substitutions. The key is the character to check (integer value) and the value is a single intege value or an array of possible substitutes.

Return Value

string

Processed text.

setDefaultMonospacedFont(string $font)

Since: 4.5.025

Defines the default monospaced font.

Parameters

string $font

Font name.

Since: 1.5

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()
Since: 1.5

Defines the page and position a link points to.

Parameters

int $link

The link identifier returned by AddLink()

float $y

Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page)

int|string $page

Number of target page; -1 indicates the current page (default value). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.

See also

AddLink()
Since: 1.5

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

float $x

Abscissa of the upper-left corner of the rectangle

float $y

Ordinate of the upper-left corner of the rectangle

float $w

Width of the rectangle

float $h

Height of the rectangle

mixed $link

URL or identifier returned by AddLink()

int $spaces

number of spaces on the text to link

See also

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

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

Since: 4.0.018 (2008-08-06)

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

!!!!THE ANNOTATION SUPPORT IS NOT YET FULLY IMPLEMENTED !!!!

Parameters

float $x

Abscissa of the upper-left corner of the rectangle

float $y

Ordinate of the upper-left corner of the rectangle

float $w

Width of the rectangle

float $h

Height of the rectangle

string $text

annotation text or alternate content

array $opt

array of options (see section 8.4 of PDF reference 1.7).

int $spaces

number of spaces on the text to link

protected _putEmbeddedFiles()

Since: 4.4.000 (2008-12-07)

Embedd the attached files.

See also

Annotation()

Text(float $x, float $y, string $txt, int $fstroke = 0, bool $fclip = false, bool $ffill = true, mixed $border = 0, int $ln = 0, string $align = '', bool $fill = false, mixed $link = '', int $stretch = 0, bool $ignore_min_height = false, string $calign = 'T', string $valign = 'M', bool $rtloff = false)

Since: 1.0

Prints a text cell at the specified position.

This method allows to place a string precisely on the page.

Parameters

float $x

Abscissa of the cell origin

float $y

Ordinate of the cell origin

string $txt

String to print

int $fstroke

outline size in user units (0 = disable)

bool $fclip

if true activate clipping mode (you must call StartTransform() before this function and StopTransform() to stop the clipping tranformation).

bool $ffill

if true fills the text

mixed $border

Indicates if borders must be drawn around the cell. The value can be a number:

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

int $ln

Indicates where the current position should go after the call. Possible values are:

  • 0: to the right (or left for RTL languages)
  • 1: to the beginning of the next line
  • 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.

string $align

Allows to center or align the text. Possible values are:

  • L or empty string: left align (default value)
  • C: center
  • R: right align
  • J: justify

bool $fill

Indicates if the cell background must be painted (true) or transparent (false).

mixed $link

URL or identifier returned by AddLink().

int $stretch

font stretch mode:

  • 0 = disabled
  • 1 = horizontal scaling only if text is larger than cell width
  • 2 = forced horizontal scaling to fit cell width
  • 3 = character spacing only if text is larger than cell width
  • 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.

bool $ignore_min_height

if true ignore automatic minimum height value.

string $calign

cell vertical alignment relative to the specified Y value. Possible values are:

  • T : cell top
  • A : font top
  • L : font baseline
  • D : font bottom
  • B : cell bottom

string $valign

text vertical alignment inside the cell. Possible values are:

  • T : top
  • C : center
  • B : bottom

bool $rtloff

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

bool AcceptPageBreak()

Since: 1.4

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

bool

See also

SetAutoPageBreak()

protected bool checkPageBreak(float $h = 0, float|null $y = null, bool $addpage = true)

Since: 3.2.000 (2008-07-01)

Add page if needed.

Parameters

float $h

Cell height. Default value: 0.

float|null $y

starting y position, leave empty for current position.

bool $addpage

if true add a page, otherwise only return the true/false state

Return Value

bool

true in case of page break, false otherwise.

Cell(float $w, float $h = 0, string $txt = '', mixed $border = 0, int $ln = 0, string $align = '', bool $fill = false, mixed $link = '', int $stretch = 0, bool $ignore_min_height = false, string $calign = 'T', string $valign = 'M')

Since: 1.0

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

float $w

Cell width. If 0, the cell extends up to the right margin.

float $h

Cell height. Default value: 0.

string $txt

String to print. Default value: empty string.

mixed $border

Indicates if borders must be drawn around the cell. The value can be a number:

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

int $ln

Indicates where the current position should go after the call. Possible values are:

  • 0: to the right (or left for RTL languages)
  • 1: to the beginning of the next line
  • 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.

string $align

Allows to center or align the text. Possible values are:

  • L or empty string: left align (default value)
  • C: center
  • R: right align
  • J: justify

bool $fill

Indicates if the cell background must be painted (true) or transparent (false).

mixed $link

URL or identifier returned by AddLink().

int $stretch

font stretch mode:

  • 0 = disabled
  • 1 = horizontal scaling only if text is larger than cell width
  • 2 = forced horizontal scaling to fit cell width
  • 3 = character spacing only if text is larger than cell width
  • 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.

bool $ignore_min_height

if true ignore automatic minimum height value.

string $calign

cell vertical alignment relative to the specified Y value. Possible values are:

  • T : cell top
  • C : center
  • B : cell bottom
  • A : font top
  • L : font baseline
  • D : font bottom

string $valign

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

protected string getCellCode(float $w, float $h = 0, string $txt = '', mixed $border = 0, int $ln = 0, string $align = '', bool $fill = false, mixed $link = '', int $stretch = 0, bool $ignore_min_height = false, string $calign = 'T', string $valign = 'M')

Since: 1.0

Returns the PDF string code to print a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.

Parameters

float $w

Cell width. If 0, the cell extends up to the right margin.

float $h

Cell height. Default value: 0.

string $txt

String to print. Default value: empty string.

mixed $border

Indicates if borders must be drawn around the cell. The value can be a number:

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

int $ln

Indicates where the current position should go after the call. Possible values are:

  • 0: to the right (or left for RTL languages)
  • 1: to the beginning of the next line
  • 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.

string $align

Allows to center or align the text. Possible values are:

  • L or empty string: left align (default value)
  • C: center
  • R: right align
  • J: justify

bool $fill

Indicates if the cell background must be painted (true) or transparent (false).

mixed $link

URL or identifier returned by AddLink().

int $stretch

font stretch mode:

  • 0 = disabled
  • 1 = horizontal scaling only if text is larger than cell width
  • 2 = forced horizontal scaling to fit cell width
  • 3 = character spacing only if text is larger than cell width
  • 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.

bool $ignore_min_height

if true ignore automatic minimum height value.

string $calign

cell vertical alignment relative to the specified Y value. Possible values are:

  • T : cell top
  • C : center
  • B : cell bottom
  • A : font top
  • L : font baseline
  • D : font bottom

string $valign

text vertical alignment inside the cell. Possible values are:

  • T : top
  • M : middle
  • B : bottom

Return Value

string

containing cell code

See also

Cell()

protected int replaceChar(int $oldchar, int $newchar)

Since: 5.9.167 (2012-06-22)

Replace a char if is defined on the current font.

Parameters

int $oldchar

Integer code (unicode) of the character to replace.

int $newchar

Integer code (unicode) of the new character.

Return Value

int

the replaced char or the old char in case the new char i not defined

protected string getCellBorder(float $x, float $y, float $w, float $h, string|array|int $brd)

Since: 5.7.000 (2010-08-02)

Returns the code to draw the cell border

Parameters

float $x

X coordinate.

float $y

Y coordinate.

float $w

Cell width.

float $h

Cell height.

string|array|int $brd

Indicates if borders must be drawn around the cell. The value can be a number:

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

Return Value

string

containing cell border code

See also

SetLineStyle()

int MultiCell(float $w, float $h, string $txt, mixed $border = 0, string $align = 'J', bool $fill = false, int $ln = 1, float|null $x = null, float|null $y = null, bool $reseth = true, int $stretch = 0, bool $ishtml = false, bool $autopadding = true, float $maxh = 0, string $valign = 'T', bool $fitcell = false)

Since: 1.3

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

float $w

Width of cells. If 0, they extend up to the right margin of the page.

float $h

Cell minimum height. The cell extends automatically if needed.

string $txt

String to print

mixed $border

Indicates if borders must be drawn around the cell. The value can be a number:

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

string $align

Allows to center or align the text. Possible values are:

  • L or empty string: left align
  • C: center
  • R: right align
  • J: justification (default value when $ishtml=false)

bool $fill

Indicates if the cell background must be painted (true) or transparent (false).

int $ln

Indicates where the current position should go after the call. Possible values are:

  • 0: to the right
  • 1: to the beginning of the next line [DEFAULT]
  • 2: below

float|null $x

x position in user units

float|null $y

y position in user units

bool $reseth

if true reset the last cell height (default true).

int $stretch

font stretch mode:

  • 0 = disabled
  • 1 = horizontal scaling only if text is larger than cell width
  • 2 = forced horizontal scaling to fit cell width
  • 3 = character spacing only if text is larger than cell width
  • 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.

bool $ishtml

INTERNAL USE ONLY -- set to true if $txt is HTML content (default = false). Never set this parameter to true, use instead writeHTMLCell() or writeHTML() methods.

bool $autopadding

if true, uses internal padding and automatically adjust it to account for line width.

float $maxh

maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature. This feature works only when $ishtml=false.

string $valign

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.

bool $fitcell

if true attempt to fit all the text within the cell by reducing the font size (do not work in HTML mode). $maxh must be greater than 0 and equal to $h.

Return Value

int

Return the number of cells or 1 for html mode.

See also

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

float getNumLines(string $txt, float $w = 0, bool $reseth = false, bool $autopadding = true, array|null $cellpadding = null, mixed $border = 0)

Since: 4.5.011

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

Parameters

string $txt

String for calculating his height

float $w

Width of cells. If 0, they extend up to the right margin of the page.

bool $reseth

if true reset the last cell height (default false).

bool $autopadding

if true, uses internal padding and automatically adjust it to account for line width (default true).

array|null $cellpadding

Internal cell padding, if empty uses default cell padding.

mixed $border

Indicates if borders must be drawn around the cell. The value can be a number:

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

Return Value

float

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

float getStringHeight(float $w, string $txt, bool $reseth = false, bool $autopadding = true, array|null $cellpadding = null, mixed $border = 0)

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

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

Parameters

float $w

Width of cells. If 0, they extend up to the right margin of the page.

string $txt

String for calculating his height

bool $reseth

if true reset the last cell height (default false).

bool $autopadding

if true, uses internal padding and automatically adjust it to account for line width (default true).

array|null $cellpadding

Internal cell padding, if empty uses default cell padding.

mixed $border

Indicates if borders must be drawn around the cell. The value can be a number:

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

Return Value

float

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

mixed Write(float $h, string $txt, mixed $link = '', bool $fill = false, string $align = '', bool $ln = false, int $stretch = 0, bool $firstline = false, bool $firstblock = false, float $maxh = 0, float $wadj = 0, array|null $margin = null)

Since: 1.5

This method prints text from the current position.

Parameters

float $h

Line height

string $txt

String to print

mixed $link

URL or identifier returned by AddLink()

bool $fill

Indicates if the cell background must be painted (true) or transparent (false).

string $align

Allows to center or align the text. Possible values are:

  • L or empty string: left align (default value)
  • C: center
  • R: right align
  • J: justify

bool $ln

if true set cursor at the bottom of the line, otherwise set cursor at the top of the line.

int $stretch

font stretch mode:

  • 0 = disabled
  • 1 = horizontal scaling only if text is larger than cell width
  • 2 = forced horizontal scaling to fit cell width
  • 3 = character spacing only if text is larger than cell width
  • 4 = forced character spacing to fit cell width
General font stretching and scaling values will be preserved when possible.

bool $firstline

if true prints only the first line and return the remaining string.

bool $firstblock

if true the string is the starting of a line.

float $maxh

maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature.

float $wadj

first line width will be reduced by this amount (used in HTML mode).

array|null $margin

margin array of the parent container

Return Value

mixed

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

protected float getRemainingWidth()

Returns the remaining width between the current position and margins.

Return Value

float

Return the remaining width

protected array fitBlock(float $w, float $h, float $x, float $y, bool $fitonpage = false)

Since: 5.5.009 (2010-07-05)

Set the block dimensions accounting for page breaks and page/column fitting

Parameters

float $w width
float $h height
float $x

X coordinate

float $y

Y coodiante

bool $fitonpage

if true the block is resized to not exceed page dimensions.

Return Value

array

array($w, $h, $x, $y)

mixed|false Image(string $file, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, string $type = '', mixed $link = '', string $align = '', mixed $resize = false, int $dpi = 300, string $palign = '', bool $ismask = false, mixed $imgmask = false, mixed $border = 0, mixed $fitbox = false, bool $hidden = false, bool $fitonpage = false, bool $alt = false, array $altimgs = array())

Since: 1.1

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

string $file

Name of the file containing the image or a '@' character followed by the image data string. To link an image without embedding it on the document, set an asterisk character before the URL (i.e.: '*http://www.example.com/image.jpg').

float|null $x

Abscissa of the upper-left corner (LTR) or upper-right corner (RTL).

float|null $y

Ordinate of the upper-left corner (LTR) or upper-right corner (RTL).

float $w

Width of the image in the page. If not specified or equal to zero, it is automatically calculated.

float $h

Height of the image in the page. If not specified or equal to zero, it is automatically calculated.

string $type

Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension.

mixed $link

URL or identifier returned by AddLink().

string $align

Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

mixed $resize

If true resize (reduce) the image to fit $w and $h (requires GD or ImageMagick library); if false do not resize; if 2 force resize in all cases (upscaling and downscaling).

int $dpi

dot-per-inch resolution used on resize

string $palign

Allows to center or align the image on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

bool $ismask

true if this image is a mask, false otherwise

mixed $imgmask

image object returned by this function or false

mixed $border

Indicates if borders must be drawn around the cell. The value can be a number:

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

mixed $fitbox

If not false scale image dimensions proportionally to fit within the ($w, $h) box. $fitbox can be true or a 2 characters string indicating the image alignment inside the box. The first character indicate the horizontal alignment (L = left, C = center, R = right) the second character indicate the vertical algnment (T = top, M = middle, B = bottom).

bool $hidden

If true do not display the image.

bool $fitonpage

If true the image is resized to not exceed page dimensions.

bool $alt

If true the image will be added as alternative and not directly printed (the ID of the image will be returned).

array $altimgs

Array of alternate images IDs. Each alternative image must be an array with two values: an integer representing the image ID (the value returned by the Image method) and a boolean value to indicate if the image is the default for printing.

Return Value

mixed|false

image information

protected ImagePngAlpha(string $file, float $x, float $y, float $wpx, float $hpx, float $w, float $h, string $type, mixed $link, string $align, bool $resize, int $dpi, string $palign, string $filehash = '')

Since: 4.3.007 (2008-12-04)

Extract info from a PNG image with alpha channel using the Imagick or GD library.

Parameters

string $file

Name of the file containing the image.

float $x

Abscissa of the upper-left corner.

float $y

Ordinate of the upper-left corner.

float $wpx

Original width of the image in pixels.

float $hpx

original height of the image in pixels.

float $w

Width of the image in the page. If not specified or equal to zero, it is automatically calculated.

float $h

Height of the image in the page. If not specified or equal to zero, it is automatically calculated.

string $type

Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension.

mixed $link

URL or identifier returned by AddLink().

string $align

Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

bool $resize

If true resize (reduce) the image to fit $w and $h (requires GD library).

int $dpi

dot-per-inch resolution used on resize

string $palign

Allows to center or align the image on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

string $filehash

File hash used to build unique file names.

See also

Image()

protected getGDgamma(resource $img, int $c)

Since: 4.3.007 (2008-12-04)

Get the GD-corrected PNG gamma value from alpha color

Parameters

resource $img

GD image Resource ID.

int $c

alpha color

Ln(float|null $h = null, bool $cell = false)

Since: 1.0

Performs a line break.

The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter.

Parameters

float|null $h

The height of the break. By default, the value equals the height of the last printed cell.

bool $cell

if true add the current left (or right o for RTL) padding to the X coordinate

See also

Cell()

float GetX()

Since: 1.2

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

float GetAbsX()

Since: 1.2

Returns the absolute X value of current position.

Return Value

float

See also

SetX()
GetY()
SetY()

float GetY()

Since: 1.0

Returns the ordinate of the current position.

Return Value

float

See also

SetY()
GetX()
SetX()

setX(float $x, bool $rtloff = false)

Since: 1.2

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

float $x

The value of the abscissa in user units.

bool $rtloff

if true always uses the page top-left corner as origin of axis.

See also

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

setY(float $y, bool $resetx = true, bool $rtloff = false)

Since: 1.0

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

float $y

The value of the ordinate in user units.

bool $resetx

if true (default) reset the X position.

bool $rtloff

if true always uses the page top-left corner as origin of axis.

See also

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

setXY(float $x, float $y, bool $rtloff = false)

Since: 1.2

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

float $x

The value of the abscissa.

float $y

The value of the ordinate.

bool $rtloff

if true always uses the page top-left corner as origin of axis.

See also

SetX()
SetY()

setAbsX(float $x)

Since: 5.9.186 (2012-09-13)

Set the absolute X coordinate of the current pointer.

Parameters

float $x

The value of the abscissa in user units.

See also

setAbsX()
setAbsY()
SetAbsXY()

setAbsY(float $y)

Since: 5.9.186 (2012-09-13)

Set the absolute Y coordinate of the current pointer.

Parameters

float $y

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

See also

setAbsX()
setAbsY()
SetAbsXY()

setAbsXY(float $x, float $y)

Since: 5.9.186 (2012-09-13)

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

Parameters

float $x

The value of the abscissa in user units.

float $y

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

See also

setAbsX()
setAbsY()
SetAbsXY()

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

Since: 1.0

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

string $name

The name of the file when saved

string $dest

Destination where to send the document. It can take one of the following values:

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

Return Value

string

See also

Close()

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

Since: 4.5.016 (2009-02-24)

Unset all class variables except the following critical variables.

Parameters

bool $destroyall

if true destroys all class variables, otherwise preserves critical variables.

bool $preserve_objcopy

if true preserves the objcopy variable

protected _dochecks()

Check for locale-related bug

protected array getInternalPageNumberAliases(string $a = '')

Return an array containing variations for the basic page number alias.

Parameters

string $a

Base alias.

Return Value

array

of page number aliases

protected array getAllInternalPageNumberAliases()

Return an array containing all internal page aliases.

Return Value

array

of page number aliases

protected string replaceRightShiftPageNumAliases(string $page, array $aliases, int $diff)

Replace right shift page number aliases with spaces to correct right alignment.

This works perfectly only when using monospaced fonts.

Parameters

string $page

Page content.

array $aliases

Array of page aliases.

int $diff

initial difference to add.

Return Value

string

replaced page content.

protected setPageBoxTypes(array $boxes)

Set page boxes to be included on page descriptions.

Parameters

array $boxes

Array of page boxes to set on document: ('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox').

protected _putpages()

Output pages (and replace page number aliases).

protected string _getannotsrefs(int $n)

Since: 5.0.010 (2010-05-17)

Get references to page annotations.

Parameters

int $n

page number

Return Value

string

protected _putannotsobjs()

Since: 4.0.018 (2008-08-06)

Output annotations objects for all pages.

!!! THIS METHOD IS NOT YET COMPLETED !!! See section 12.5 of PDF 32000_2008 reference.

protected int _putAPXObject(int $w = 0, int $h = 0, string $stream = '')

Since: 4.8.001 (2009-09-09)

Put appearance streams XObject used to define annotation's appearance states.

Parameters

int $w

annotation width

int $h

annotation height

string $stream

appearance stream

Return Value

int

object ID

protected _putfonts()

Output fonts.

protected _puttruetypeunicode(array $font)

Since: 1.52.0.TC005 (2005-01-05)

Adds unicode fonts.
Based on PDF Reference 1.3 (section 5)

Parameters

array $font

font data

protected _putcidfont0(array $font)

Since: 3.2.000 (2008-06-23)

Output CID-0 fonts.

A Type 0 CIDFont contains glyph descriptions based on the Adobe Type 1 font format

Parameters

array $font

font data

protected _putimages()

Output images.

protected _putxobjects()

Since: 5.8.017 (2010-08-24)

Output Form XObjects Templates.

See also

startTemplate()
endTemplate()
printTemplate()

protected _putspotcolors()

Since: 4.0.024 (2008-09-12)

Output Spot Colors Resources.

protected string _getxobjectdict()

Since: 5.8.014 (2010-08-23)

Return XObjects Dictionary.

Return Value

string

XObjects dictionary

protected _putresourcedict()

Output Resources Dictionary.

protected _putresources()

Output Resources.

protected int _putinfo()

Adds some Metadata information (Document Information Dictionary) (see Chapter 14.3.3 Document Information Dictionary of PDF32000_2008.pdf Reference)

Return Value

int

object id

setExtraXMP(string $xmp)

Since: 5.9.128 (2011-10-06)

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

string $xmp

Custom XMP data.

setExtraXMPRDF(string $xmp)

Since: 6.3.0 (2019-09-19)

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

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

Parameters

string $xmp

Custom XMP RDF data.

protected int _putXMP()

Since: 5.9.121 (2011-09-28)

Put XMP data object and return ID.

Return Value

int

The object ID.

protected int _putcatalog()

Output Catalog.

Return Value

int

object id

protected string _putviewerpreferences()

Since: 3.1.000 (2008-06-09)

Output viewer preferences.

Return Value

string

for viewer preferences

protected _putheader()

Output PDF File Header (7.5.2).

protected _enddoc()

Output end of document (EOF).

protected _beginpage(string $orientation = '', mixed $format = '')

Initialize a new page.

Parameters

string $orientation

page orientation. Possible values are (case insensitive):

  • P or PORTRAIT (default)
  • L or LANDSCAPE

mixed $format

The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().

See also

getPageSizeFromFormat()
setPageFormat()

protected _endpage()

Mark end of page.

protected int _newobj()

Begin a new object and return the object number.

Return Value

int

object number

protected string _getobj(int|null $objid = null)

Since: 5.8.009 (2010-08-20)

Return the starting object string for the selected object ID.

Parameters

int|null $objid

Object ID (leave empty to get a new ID).

Return Value

string

the starting object string

protected _dounderline(int $x, int $y, string $txt)

Underline text.

Parameters

int $x

X coordinate

int $y

Y coordinate

string $txt

text to underline

protected _dounderlinew(int $x, int $y, int $w)

Since: 4.8.008 (2009-09-29)

Underline for rectangular text area.

Parameters

int $x

X coordinate

int $y

Y coordinate

int $w

width to underline

protected _dolinethrough(int $x, int $y, string $txt)

Line through text.

Parameters

int $x

X coordinate

int $y

Y coordinate

string $txt

text to linethrough

protected _dolinethroughw(int $x, int $y, int $w)

Since: 4.9.008 (2009-09-29)

Line through for rectangular text area.

Parameters

int $x

X coordinate

int $y

Y coordinate

int $w

line length (width)

protected _dooverline(int $x, int $y, string $txt)

Since: 4.9.015 (2010-04-19)

Overline text.

Parameters

int $x

X coordinate

int $y

Y coordinate

string $txt

text to overline

protected _dooverlinew(int $x, int $y, int $w)

Since: 4.9.015 (2010-04-19)

Overline for rectangular text area.

Parameters

int $x

X coordinate

int $y

Y coordinate

int $w

width to overline

protected string _datastring(string $s, int $n = 0)

Format a data string for meta information

Parameters

string $s

data string to escape.

int $n

object ID

Return Value

string

escaped string.

setDocCreationTimestamp(mixed $time)

Since: 5.9.152 (2012-03-23)

Set the document creation timestamp

Parameters

mixed $time

Document creation timestamp in seconds or date-time string.

setDocModificationTimestamp(mixed $time)

Since: 5.9.152 (2012-03-23)

Set the document modification timestamp

Parameters

mixed $time

Document modification timestamp in seconds or date-time string.

int getDocCreationTimestamp()

Since: 5.9.152 (2012-03-23)

Returns document creation timestamp in seconds.

Return Value

int

Creation timestamp in seconds.

int getDocModificationTimestamp()

Since: 5.9.152 (2012-03-23)

Returns document modification timestamp in seconds.

Return Value

int

Modfication timestamp in seconds.

protected string _datestring(int $n = 0, int $timestamp = 0)

Since: 4.6.028 (2009-08-25)

Returns a formatted date for meta information

Parameters

int $n

Object ID.

int $timestamp

Timestamp to convert.

Return Value

string

escaped date string.

protected string _textstring(string $s, int $n = 0)

Format a text string for meta information

Parameters

string $s

string to escape.

int $n

object ID

Return Value

string

escaped string.

protected _getrawstream(string $s, int $n = 0)

Since: 5.5.000 (2010-06-22)

get raw output stream.

Parameters

string $s

string to output.

int $n

object reference for encryption mode

protected _out(string $s)

Output a string to the document.

Parameters

string $s

string to output.

setHeaderFont(array<int,string|float|null> $font)

Since: 1.1

Set header font.

Parameters

array<int,string|float|null> $font

Array describing the basic font parameters: (family, style, size).

array<int,string|float|null> getHeaderFont()

Since: 4.0.012 (2008-07-24)

Get header font.

Return Value

array<int,string|float|null>

Array describing the basic font parameters: (family, style, size).

setFooterFont(array<int,string|float|null> $font)

Since: 1.1

Set footer font.

Parameters

array<int,string|float|null> $font

Array describing the basic font parameters: (family, style, size).

array<int,string|float|null> getFooterFont()

Since: 4.0.012 (2008-07-24)

Get Footer font.

Return Value

array<int,string|float|null>

Array describing the basic font parameters: (family, style, size).

setLanguageArray(array $language)

Since: 1.1

Set language array.

Parameters

array $language

getPDFData()

Returns the PDF data.

Output anchor link.

Parameters

string $url

link URL or internal link (i.e.: <a href="#23,4.5">link to page 23 at 4.5 Y position</a>)

string $name

link name

bool $fill

Indicates if the cell background must be painted (true) or transparent (false).

bool $firstline

if true prints only the first line and return the remaining string.

array|null $color

array of RGB text color

string $style

font style (U, D, B, I)

bool $firstblock

if true the string is the starting of a line.

Return Value

int

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

float pixelsToUnits(int $px)

Converts pixels to User's Units.

Parameters

int $px pixels

Return Value

float

value in user's unit

See also

setImageScale()
getImageScale()

string unhtmlentities(string $text_to_convert)

Reverse function for htmlentities.

Convert entities in UTF-8.

Parameters

string $text_to_convert

Text to convert.

Return Value

string

converted text string

protected int _objectkey(int $n)

Since: 2.0.000 (2008-01-02)

Compute encryption key depending on object number where the encrypted data is stored.

This is used for all strings and streams without crypt filter specifier.

Parameters

int $n

object number

Return Value

int

object key

protected string _encrypt_data(int $n, string $s)

Since: 5.0.005 (2010-05-11)

Encrypt the input string.

Parameters

int $n

object number

string $s

data string to encrypt

Return Value

string

encrypted string

protected _putencryption()

Since: 2.0.000 (2008-01-02)

Put encryption on PDF document.

protected string _Uvalue()

Since: 2.0.000 (2008-01-02)

Compute U value (used for encryption)

Return Value

string

U value

protected string _UEvalue()

Since: 5.9.006 (2010-10-19)

Compute UE value (used for encryption)

Return Value

string

UE value

protected string _Ovalue()

Since: 2.0.000 (2008-01-02)

Compute O value (used for encryption)

Return Value

string

O value

protected string _OEvalue()

Since: 5.9.006 (2010-10-19)

Compute OE value (used for encryption)

Return Value

string

OE value

protected string _fixAES256Password(string $password)

Since: 5.9.006 (2010-10-19)

Convert password for AES-256 encryption mode

Parameters

string $password password

Return Value

string password

protected _generateencryptionkey()

Since: 2.0.000 (2008-01-02)

Compute encryption key

setProtection(array $permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), string $user_pass = '', string|null $owner_pass = null, int $mode = 0, array|null $pubkeys = null)

Since: 2.0.000 (2008-01-02)

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

array $permissions

the set of permissions (specify the ones you want to block):

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

string $user_pass

user password. Empty by default.

string|null $owner_pass

owner password. If not specified, a random value is used.

int $mode

encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit.

array|null $pubkeys

array of recipients containing public-key certificates ('c') and permissions ('p'). For example: array(array('c' => 'file://../examples/data/cert/tcpdf.crt', 'p' => array('print')))

StartTransform()

Since: 2.1.000 (2008-01-07)

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

StopTransform()

Since: 2.1.000 (2008-01-07)

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

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

Since: 2.1.000 (2008-01-07)

Horizontal Scaling.

Parameters

float $s_x

scaling factor for width as percent. 0 is not allowed.

int $x

abscissa of the scaling center. Default is current x position

int $y

ordinate of the scaling center. Default is current y position

See also

StartTransform()
StopTransform()

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

Since: 2.1.000 (2008-01-07)

Vertical Scaling.

Parameters

float $s_y

scaling factor for height as percent. 0 is not allowed.

int $x

abscissa of the scaling center. Default is current x position

int $y

ordinate of the scaling center. Default is current y position

See also

StartTransform()
StopTransform()

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

Since: 2.1.000 (2008-01-07)

Vertical and horizontal proportional Scaling.

Parameters

float $s

scaling factor for width and height as percent. 0 is not allowed.

int $x

abscissa of the scaling center. Default is current x position

int $y

ordinate of the scaling center. Default is current y position

See also

StartTransform()
StopTransform()

Scale(float $s_x, float $s_y, float|null $x = null, float|null $y = null)

Since: 2.1.000 (2008-01-07)

Vertical and horizontal non-proportional Scaling.

Parameters

float $s_x

scaling factor for width as percent. 0 is not allowed.

float $s_y

scaling factor for height as percent. 0 is not allowed.

float|null $x

abscissa of the scaling center. Default is current x position

float|null $y

ordinate of the scaling center. Default is current y position

See also

StartTransform()
StopTransform()

MirrorH(float|null $x = null)

Since: 2.1.000 (2008-01-07)

Horizontal Mirroring.

Parameters

float|null $x

abscissa of the point. Default is current x position

See also

StartTransform()
StopTransform()

MirrorV(float|null $y = null)

Since: 2.1.000 (2008-01-07)

Verical Mirroring.

Parameters

float|null $y

ordinate of the point. Default is current y position

See also

StartTransform()
StopTransform()

MirrorP(float|null $x = null, float|null $y = null)

Since: 2.1.000 (2008-01-07)

Point reflection mirroring.

Parameters

float|null $x

abscissa of the point. Default is current x position

float|null $y

ordinate of the point. Default is current y position

See also

StartTransform()
StopTransform()

MirrorL(float $angle = 0, float|null $x = null, float|null $y = null)

Since: 2.1.000 (2008-01-07)

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

Parameters

float $angle

gradient angle of the straight line. Default is 0 (horizontal line).

float|null $x

abscissa of the point. Default is current x position

float|null $y

ordinate of the point. Default is current y position

See also

StartTransform()
StopTransform()

TranslateX(int $t_x)

Since: 2.1.000 (2008-01-07)

Translate graphic object horizontally.

Parameters

int $t_x

movement to the right (or left for RTL)

See also

StartTransform()
StopTransform()

TranslateY(int $t_y)

Since: 2.1.000 (2008-01-07)

Translate graphic object vertically.

Parameters

int $t_y

movement to the bottom

See also

StartTransform()
StopTransform()

Translate(int $t_x, int $t_y)

Since: 2.1.000 (2008-01-07)

Translate graphic object horizontally and vertically.

Parameters

int $t_x

movement to the right

int $t_y

movement to the bottom

See also

StartTransform()
StopTransform()

Rotate(float $angle, float|null $x = null, float|null $y = null)

Since: 2.1.000 (2008-01-07)

Rotate object.

Parameters

float $angle

angle in degrees for counter-clockwise rotation

float|null $x

abscissa of the rotation center. Default is current x position

float|null $y

ordinate of the rotation center. Default is current y position

See also

StartTransform()
StopTransform()

SkewX(float $angle_x, float|null $x = null, float|null $y = null)

Since: 2.1.000 (2008-01-07)

Skew horizontally.

Parameters

float $angle_x

angle in degrees between -90 (skew to the left) and 90 (skew to the right)

float|null $x

abscissa of the skewing center. default is current x position

float|null $y

ordinate of the skewing center. default is current y position

See also

StartTransform()
StopTransform()

SkewY(float $angle_y, float|null $x = null, float|null $y = null)

Since: 2.1.000 (2008-01-07)

Skew vertically.

Parameters

float $angle_y

angle in degrees between -90 (skew to the bottom) and 90 (skew to the top)

float|null $x

abscissa of the skewing center. default is current x position

float|null $y

ordinate of the skewing center. default is current y position

See also

StartTransform()
StopTransform()

Skew(float $angle_x, float $angle_y, float|null $x = null, float|null $y = null)

Since: 2.1.000 (2008-01-07)

Skew.

Parameters

float $angle_x

angle in degrees between -90 (skew to the left) and 90 (skew to the right)

float $angle_y

angle in degrees between -90 (skew to the bottom) and 90 (skew to the top)

float|null $x

abscissa of the skewing center. default is current x position

float|null $y

ordinate of the skewing center. default is current y position

See also

StartTransform()
StopTransform()

protected Transform(array $tm)

Since: 2.1.000 (2008-01-07)

Apply graphic transformations.

Parameters

array $tm

transformation matrix

See also

StartTransform()
StopTransform()

setLineWidth(float $width)

Since: 1.0

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

float $width

The width.

See also

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

int GetLineWidth()

Since: 2.1.000 (2008-01-07)

Returns the current the line width.

Return Value

int

Line width

See also

Line()
SetLineWidth()

string setLineStyle(array $style, bool $ret = false)

Since: 2.1.000 (2008-01-08)

Set line style.

Parameters

array $style

Line style. Array with keys among the following:

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

if true do not send the command.

Return Value

string

the PDF command

protected _outPoint(float $x, float $y)

Since: 2.1.000 (2008-01-08)

Begin a new subpath by moving the current point to coordinates (x, y), omitting any connecting line segment.

Parameters

float $x

Abscissa of point.

float $y

Ordinate of point.

protected _outLine(float $x, float $y)

Since: 2.1.000 (2008-01-08)

Append a straight line segment from the current point to the point (x, y).

The new current point shall be (x, y).

Parameters

float $x

Abscissa of end point.

float $y

Ordinate of end point.

protected _outRect(float $x, float $y, float $w, float $h, string $op)

Since: 2.1.000 (2008-01-08)

Append a rectangle to the current path as a complete subpath, with lower-left corner (x, y) and dimensions widthand height in user space.

Parameters

float $x

Abscissa of upper-left corner.

float $y

Ordinate of upper-left corner.

float $w Width.
float $h Height.
string $op options

protected _outCurve(float $x1, float $y1, float $x2, float $y2, float $x3, float $y3)

Since: 2.1.000 (2008-01-08)

Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as the Bezier control points.

The new current point shall be (x3, y3).

Parameters

float $x1

Abscissa of control point 1.

float $y1

Ordinate of control point 1.

float $x2

Abscissa of control point 2.

float $y2

Ordinate of control point 2.

float $x3

Abscissa of end point.

float $y3

Ordinate of end point.

protected _outCurveV(float $x2, float $y2, float $x3, float $y3)

Since: 4.9.019 (2010-04-26)

Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using the current point and (x2, y2) as the Bezier control points.

The new current point shall be (x3, y3).

Parameters

float $x2

Abscissa of control point 2.

float $y2

Ordinate of control point 2.

float $x3

Abscissa of end point.

float $y3

Ordinate of end point.

protected _outCurveY(float $x1, float $y1, float $x3, float $y3)

Since: 2.1.000 (2008-01-08)

Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the Bezier control points.

The new current point shall be (x3, y3).

Parameters

float $x1

Abscissa of control point 1.

float $y1

Ordinate of control point 1.

float $x3

Abscissa of end point.

float $y3

Ordinate of end point.

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

Since: 1.0

Draws a line between two points.

Parameters

float $x1

Abscissa of first point.

float $y1

Ordinate of first point.

float $x2

Abscissa of second point.

float $y2

Ordinate of second point.

array $style

Line style. Array like for SetLineStyle(). Default value: default line style (empty array).

See also

SetLineWidth()
SetDrawColor()
SetLineStyle()

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

Since: 1.0

Draws a rectangle.

Parameters

float $x

Abscissa of upper-left corner.

float $y

Ordinate of upper-left corner.

float $w Width.
float $h Height.
string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $border_style

Border style of rectangle. Array with keys among the following:

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

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

array $fill_color

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

See also

SetLineStyle()

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

Since: 2.1.000 (2008-01-08)

Draws a Bezier curve.

The Bezier curve is a tangent to the line between the control points at either end of the curve.

Parameters

float $x0

Abscissa of start point.

float $y0

Ordinate of start point.

float $x1

Abscissa of control point 1.

float $y1

Ordinate of control point 1.

float $x2

Abscissa of control point 2.

float $y2

Ordinate of control point 2.

float $x3

Abscissa of end point.

float $y3

Ordinate of end point.

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $line_style

Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array).

array $fill_color

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

See also

SetLineStyle()

Polycurve(float $x0, float $y0, float[] $segments, string $style = '', array $line_style = array(), array $fill_color = array())

Since: 3.0008 (2008-05-12)

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

float $x0

Abscissa of start point.

float $y0

Ordinate of start point.

float[] $segments

An array of bezier descriptions. Format: array(x1, y1, x2, y2, x3, y3).

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $line_style

Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array).

array $fill_color

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

See also

SetLineStyle()

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

Since: 2.1.000 (2008-01-08)

Draws an ellipse.

An ellipse is formed from n Bezier curves.

Parameters

float $x0

Abscissa of center point.

float $y0

Ordinate of center point.

float $rx

Horizontal radius.

float $ry

Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0.

float $angle

Angle oriented (anti-clockwise). Default value: 0.

float $astart

Angle start of draw line. Default value: 0.

float $afinish

Angle finish of draw line. Default value: 360.

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $line_style

Line style of ellipse. Array like for SetLineStyle(). Default value: default line style (empty array).

array $fill_color

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

int $nc

Number of curves used to draw a 90 degrees portion of ellipse.

protected array _outellipticalarc(float $xc, float $yc, float $rx, float $ry, float $xang = 0, float $angs = 0, float $angf = 360, bool $pie = false, int $nc = 2, bool $startpoint = true, bool $ccw = true, bool $svg = false)

Since: 4.9.019 (2010-04-26)

Append an elliptical arc to the current path.

An ellipse is formed from n Bezier curves.

Parameters

float $xc

Abscissa of center point.

float $yc

Ordinate of center point.

float $rx

Horizontal radius.

float $ry

Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0.

float $xang

Angle between the X-axis and the major axis of the ellipse. Default value: 0.

float $angs

Angle start of draw line. Default value: 0.

float $angf

Angle finish of draw line. Default value: 360.

bool $pie

if true do not mark the border point (used to draw pie sectors).

int $nc

Number of curves used to draw a 90 degrees portion of ellipse.

bool $startpoint

if true output a starting point.

bool $ccw

if true draws in counter-clockwise.

bool $svg

if true the angles are in svg mode (already calculated).

Return Value

array

bounding box coordinates (x min, y min, x max, y max)

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

Since: 2.1.000 (2008-01-08)

Draws a circle.

A circle is formed from n Bezier curves.

Parameters

float $x0

Abscissa of center point.

float $y0

Ordinate of center point.

float $r Radius.
float $angstr

Angle start of draw line. Default value: 0.

float $angend

Angle finish of draw line. Default value: 360.

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $line_style

Line style of circle. Array like for SetLineStyle(). Default value: default line style (empty array).

array $fill_color

Fill color. Format: array(red, green, blue). Default value: default color (empty array).

int $nc

Number of curves used to draw a 90 degrees portion of circle.

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

Since: 4.8.003 (2009-09-15)

Draws a polygonal line

Parameters

array $p

Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1))

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $line_style

Line style of polygon. Array with keys among the following:

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

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

array $fill_color

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

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

Since: 2.1.000 (2008-01-08)

Draws a polygon.

Parameters

array $p

Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1))

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $line_style

Line style of polygon. Array with keys among the following:

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

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

array $fill_color

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

bool $closed

if true the polygon is closes, otherwise will remain open

RegularPolygon(float $x0, float $y0, float $r, int $ns, float $angle = 0, bool $draw_circle = false, string $style = '', array $line_style = array(), array $fill_color = array(), string $circle_style = '', array $circle_outLine_style = array(), array $circle_fill_color = array())

Since: 2.1.000 (2008-01-08)

Draws a regular polygon.

Parameters

float $x0

Abscissa of center point.

float $y0

Ordinate of center point.

float $r

Radius of inscribed circle.

int $ns

Number of sides.

float $angle

Angle oriented (anti-clockwise). Default value: 0.

bool $draw_circle

Draw inscribed circle or not. Default value: false.

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $line_style

Line style of polygon sides. Array with keys among the following:

  • all: Line style of all sides. Array like for SetLineStyle().
  • 0 to ($ns - 1): Line style of each side. Array like for SetLineStyle().

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

array $fill_color

Fill color. Format: array(red, green, blue). Default value: default color (empty array).

string $circle_style

Style of rendering of inscribed circle (if draws). Possible values are:

  • D or empty string: Draw (default).
  • F: Fill.
  • DF or FD: Draw and fill.
  • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
  • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
array $circle_outLine_style

Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array).

array $circle_fill_color

Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array).

StarPolygon(float $x0, float $y0, float $r, int $nv, int $ng, float $angle = 0, bool $draw_circle = false, string $style = '', array $line_style = array(), array $fill_color = array(), string $circle_style = '', array $circle_outLine_style = array(), array $circle_fill_color = array())

Since: 2.1.000 (2008-01-08)

Draws a star polygon

Parameters

float $x0

Abscissa of center point.

float $y0

Ordinate of center point.

float $r

Radius of inscribed circle.

int $nv

Number of vertices.

int $ng

Number of gap (if ($ng % $nv = 1) then is a regular polygon).

float $angle

Angle oriented (anti-clockwise). Default value: 0.

bool $draw_circle

Draw inscribed circle or not. Default value is false.

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $line_style

Line style of polygon sides. Array with keys among the following:

  • all: Line style of all sides. Array like for SetLineStyle().
  • 0 to (n - 1): Line style of each side. Array like for SetLineStyle().

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

array $fill_color

Fill color. Format: array(red, green, blue). Default value: default color (empty array).

string $circle_style

Style of rendering of inscribed circle (if draws). Possible values are:

  • D or empty string: Draw (default).
  • F: Fill.
  • DF or FD: Draw and fill.
  • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
  • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
array $circle_outLine_style

Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array).

array $circle_fill_color

Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array).

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

Since: 2.1.000 (2008-01-08)

Draws a rounded rectangle.

Parameters

float $x

Abscissa of upper-left corner.

float $y

Ordinate of upper-left corner.

float $w Width.
float $h Height.
float $r

the radius of the circle used to round off the corners of the rectangle.

string $round_corner

Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111").

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $border_style

Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array).

array $fill_color

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

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

Since: 4.9.019 (2010-04-22)

Draws a rounded rectangle.

Parameters

float $x

Abscissa of upper-left corner.

float $y

Ordinate of upper-left corner.

float $w Width.
float $h Height.
float $rx

the x-axis radius of the ellipse used to round off the corners of the rectangle.

float $ry

the y-axis radius of the ellipse used to round off the corners of the rectangle.

string $round_corner

Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111").

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

array $border_style

Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array).

array $fill_color

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

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

Since: 4.6.018 (2009-07-10)

Draws a grahic arrow.

Parameters

float $x0

Abscissa of first point.

float $y0

Ordinate of first point.

float $x1

Abscissa of second point.

float $y1

Ordinate of second point.

int $head_style

(0 = draw only arrowhead arms, 1 = draw closed arrowhead, but no fill, 2 = closed and filled arrowhead, 3 = filled arrowhead)

float $arm_size

length of arrowhead arms

int $arm_angle

angle between an arm and the shaft

string|false setDestination(string $name, float $y = -1, int|string $page = '', float $x = -1)

Since: 5.9.097 (2011-06-23)

Add a Named Destination.

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

Parameters

string $name

Destination name.

float $y

Y position in user units of the destiantion on the selected page (default = -1 = current position; 0 = page start;).

int|string $page

Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.

float $x

X position in user units of the destiantion on the selected page (default = -1 = current position;).

Return Value

string|false

Stripped named destination identifier or false in case of error.

array getDestination()

Since: 5.9.097 (2011-06-23)

Return the Named Destination array.

Return Value

array

Named Destination array.

protected _putdests()

Since: 5.9.098 (2011-06-23)

Insert Named Destinations.

setBookmark(string $txt, int $level = 0, float $y = -1, int|string $page = '', string $style = '', array $color = array(0, 0, 0), float $x = -1, mixed $link = '')

Adds a bookmark - alias for Bookmark().

Parameters

string $txt

Bookmark description.

int $level

Bookmark level (minimum value is 0).

float $y

Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;).

int|string $page

Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.

string $style

Font style: B = Bold, I = Italic, BI = Bold + Italic.

array $color

RGB color array (values from 0 to 255).

float $x

X position in user units of the bookmark on the selected page (default = -1 = current position;).

mixed $link

URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name).

Bookmark(string $txt, int $level = 0, float $y = -1, int|string $page = '', string $style = '', array $color = array(0, 0, 0), float $x = -1, mixed $link = '')

Since: 2.1.002 (2008-02-12)

Adds a bookmark.

Parameters

string $txt

Bookmark description.

int $level

Bookmark level (minimum value is 0).

float $y

Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;).

int|string $page

Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.

string $style

Font style: B = Bold, I = Italic, BI = Bold + Italic.

array $color

RGB color array (values from 0 to 255).

float $x

X position in user units of the bookmark on the selected page (default = -1 = current position;).

mixed $link

URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name).

protected sortBookmarks()

Since: 5.9.119 (2011-09-19)

Sort bookmarks for page and key.

protected _putbookmarks()

Since: 2.1.002 (2008-02-12)

Create a bookmark PDF string.

IncludeJS(string $script)

Since: 2.1.002 (2008-02-12)

Adds a javascript

Parameters

string $script

Javascript code

int addJavascriptObject(string $script, bool $onload = false)

Since: 4.8.000 (2009-09-07)

Adds a javascript object and return object ID

Parameters

string $script

Javascript code

bool $onload

if true executes this object when opening the document

Return Value

int

internal object ID

protected _putjavascript()

Since: 2.1.002 (2008-02-12)

Create a javascript PDF string.

protected _addfield(string $type, string $name, int $x, int $y, int $w, int $h, array $prop)

Since: 2.1.002 (2008-02-12)

Adds a javascript form field.

Parameters

string $type

field type

string $name

field name

int $x

horizontal position

int $y

vertical position

int $w width
int $h height
array $prop

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

setFormDefaultProp(array $prop = array())

Since: 4.8.000 (2009-09-06)

Set default properties for form fields.

Parameters

array $prop

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

array getFormDefaultProp()

Since: 4.8.000 (2009-09-06)

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.

TextField(string $name, float $w, float $h, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)

Since: 4.8.000 (2009-09-07)

Creates a text field

Parameters

string $name

field name

float $w

Width of the rectangle

float $h

Height of the rectangle

array $prop

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

array $opt

annotation parameters. Possible values are described on official PDF32000_2008 reference.

float|null $x

Abscissa of the upper-left corner of the rectangle

float|null $y

Ordinate of the upper-left corner of the rectangle

bool $js

if true put the field using JavaScript (requires Acrobat Writer to be rendered).

RadioButton(string $name, int $w, array $prop = array(), array $opt = array(), string $onvalue = 'On', bool $checked = false, float|null $x = null, float|null $y = null, bool $js = false)

Since: 4.8.000 (2009-09-07)

Creates a RadioButton field.

Parameters

string $name

Field name.

int $w

Width of the radio button.

array $prop

Javascript field properties. Possible values are described on official Javascript for Acrobat API reference.

array $opt

Annotation parameters. Possible values are described on official PDF32000_2008 reference.

string $onvalue

Value to be returned if selected.

bool $checked

Define the initial state.

float|null $x

Abscissa of the upper-left corner of the rectangle

float|null $y

Ordinate of the upper-left corner of the rectangle

bool $js

If true put the field using JavaScript (requires Acrobat Writer to be rendered).

ListBox(string $name, int $w, int $h, array $values, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)

Since: 4.8.000 (2009-09-07)

Creates a List-box field

Parameters

string $name

field name

int $w width
int $h height
array $values

array containing the list of values.

array $prop

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

array $opt

annotation parameters. Possible values are described on official PDF32000_2008 reference.

float|null $x

Abscissa of the upper-left corner of the rectangle

float|null $y

Ordinate of the upper-left corner of the rectangle

bool $js

if true put the field using JavaScript (requires Acrobat Writer to be rendered).

ComboBox(string $name, int $w, int $h, array $values, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)

Since: 4.8.000 (2009-09-07)

Creates a Combo-box field

Parameters

string $name

field name

int $w width
int $h height
array $values

array containing the list of values.

array $prop

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

array $opt

annotation parameters. Possible values are described on official PDF32000_2008 reference.

float|null $x

Abscissa of the upper-left corner of the rectangle

float|null $y

Ordinate of the upper-left corner of the rectangle

bool $js

if true put the field using JavaScript (requires Acrobat Writer to be rendered).

CheckBox(string $name, int $w, bool $checked = false, array $prop = array(), array $opt = array(), string $onvalue = 'Yes', float|null $x = null, float|null $y = null, bool $js = false)

Since: 4.8.000 (2009-09-07)

Creates a CheckBox field

Parameters

string $name

field name

int $w width
bool $checked

define the initial state.

array $prop

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

array $opt

annotation parameters. Possible values are described on official PDF32000_2008 reference.

string $onvalue

value to be returned if selected.

float|null $x

Abscissa of the upper-left corner of the rectangle

float|null $y

Ordinate of the upper-left corner of the rectangle

bool $js

if true put the field using JavaScript (requires Acrobat Writer to be rendered).

Button(string $name, int $w, int $h, string $caption, mixed $action, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)

Since: 4.8.000 (2009-09-07)

Creates a button field

Parameters

string $name

field name

int $w width
int $h height
string $caption caption.
mixed $action

action triggered by pressing the button. Use a string to specify a javascript action. Use an array to specify a form action options as on section 12.7.5 of PDF32000_2008.

array $prop

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

array $opt

annotation parameters. Possible values are described on official PDF32000_2008 reference.

float|null $x

Abscissa of the upper-left corner of the rectangle

float|null $y

Ordinate of the upper-left corner of the rectangle

bool $js

if true put the field using JavaScript (requires Acrobat Writer to be rendered).

protected _putsignature()

Since: 4.6.008 (2009-05-07)

Add certification signature (DocMDP or UR3) You can set only one signature type

setUserRights(bool $enable = true, string $document = '/FullSave', string $annots = '/Create/Delete/Modify/Copy/Import/Export', string $form = '/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate', string $signature = '/Modify', string $ef = '/Create/Delete/Modify/Import', string $formex = '')

Since: 2.9.000 (2008-03-26)

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

bool $enable

if true enable user's rights on PDF reader

string $document

Names specifying additional document-wide usage rights for the document. The only defined value is "/FullSave", which permits a user to save the document along with modified form and/or annotation data.

string $annots

Names specifying additional annotation-related usage rights for the document. Valid names in PDF 1.5 and later are /Create/Delete/Modify/Copy/Import/Export, which permit the user to perform the named operation on annotations.

string $form

Names specifying additional form-field-related usage rights for the document. Valid names are: /Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate

string $signature

Names specifying additional signature-related usage rights for the document. The only defined value is /Modify, which permits a user to apply a digital signature to an existing signature form field or clear a signed signature form field.

string $ef

Names specifying additional usage rights for named embedded files in the document. Valid names are /Create/Delete/Modify/Import, which permit the user to perform the named operation on named embedded files Names specifying additional embedded-files-related usage rights for the document.

string $formex

Names specifying additional form-field-related usage rights. The only valid name is BarcodePlaintext, which permits text form field data to be encoded as a plaintext two-dimensional barcode.

setSignature(mixed $signing_cert = '', mixed $private_key = '', string $private_key_password = '', string $extracerts = '', int $cert_type = 2, array $info = array(), string $approval = '')

Since: 4.6.005 (2009-04-24)

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

mixed $signing_cert

signing certificate (string or filename prefixed with 'file://')

mixed $private_key

private key (string or filename prefixed with 'file://')

string $private_key_password password
string $extracerts

specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used.

int $cert_type

The access permissions granted for this document. Valid values shall be: 1 = No changes to the document shall be permitted; any change to the document shall invalidate the signature; 2 = Permitted changes shall be filling in forms, instantiating page templates, and signing; other changes shall invalidate the signature; 3 = Permitted changes shall be the same as for 2, as well as annotation creation, deletion, and modification; other changes shall invalidate the signature.

array $info

array of option information: Name, Location, Reason, ContactInfo.

string $approval

Enable approval signature eg. for PDF incremental update

setSignatureAppearance(float $x = 0, float $y = 0, float $w = 0, float $h = 0, int $page = -1, string $name = '')

Since: 5.3.011 (2010-06-17)

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

Parameters

float $x

Abscissa of the upper-left corner.

float $y

Ordinate of the upper-left corner.

float $w

Width of the signature area.

float $h

Height of the signature area.

int $page

option page number (if < 0 the current page is used).

string $name

Name of the signature.

addEmptySignatureAppearance(float $x = 0, float $y = 0, float $w = 0, float $h = 0, int $page = -1, string $name = '')

Since: 5.9.101 (2011-07-06)

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

Parameters

float $x

Abscissa of the upper-left corner.

float $y

Ordinate of the upper-left corner.

float $w

Width of the signature area.

float $h

Height of the signature area.

int $page

option page number (if < 0 the current page is used).

string $name

Name of the signature.

protected array getSignatureAppearanceArray(float $x = 0, float $y = 0, float $w = 0, float $h = 0, int $page = -1, string $name = '')

Since: 5.9.101 (2011-07-06)

Get the array that defines the signature appearance (page and rectangle coordinates).

Parameters

float $x

Abscissa of the upper-left corner.

float $y

Ordinate of the upper-left corner.

float $w

Width of the signature area.

float $h

Height of the signature area.

int $page

option page number (if < 0 the current page is used).

string $name

Name of the signature.

Return Value

array

Array defining page and rectangle coordinates of signature appearance.

setTimeStamp(string $tsa_host = '', string $tsa_username = '', string $tsa_password = '', string $tsa_cert = '')

Since: 6.0.090 (2014-06-16)

Enable document timestamping (requires the OpenSSL Library).

The trusted timestamping improve document security that means that no one should be able to change the document once it has been recorded. Use with digital signature only!

Parameters

string $tsa_host

Time Stamping Authority (TSA) server (prefixed with 'https://')

string $tsa_username

Specifies the username for TSA authorization (optional) OR specifies the TSA authorization PEM file (see: example_66.php, optional)

string $tsa_password

Specifies the password for TSA authorization (optional)

string $tsa_cert

Specifies the location of TSA certificate for authorization (optional for cURL)

protected string applyTSA(string $signature)

Since: 6.0.090 (2014-06-16)

NOT YET IMPLEMENTED Request TSA for a timestamp

Parameters

string $signature

Digital signature as binary string

Return Value

string

Timestamped digital signature

startPageGroup(int|null $page = null)

Since: 3.0.000 (2008-03-27)

Create a new page group.

NOTE: call this function before calling AddPage()

Parameters

int|null $page

starting group page (leave empty for next page).

setStartingPageNumber(int $num = 1)

Since: 5.9.093 (2011-06-16)

Set the starting page number.

Parameters

int $num

Starting page number.

string getAliasRightShift()

Since: 5.9.099 (2011-06-27)

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

string getAliasNbPages()

Since: 4.0.018 (2008-08-08)

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

string getAliasNumPage()

Since: 4.5.000 (2009-01-02)

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

string getPageGroupAlias()

Since: 3.0.000 (2008-03-27)

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

string

alias of the current page group

string getPageNumGroupAlias()

Since: 4.5.000 (2009-01-02)

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

string

alias of the current page group

int getGroupPageNo()

Since: 3.0.000 (2008-03-27)

Return the current page in the group.

Return Value

int

current page in the group

getGroupPageNoFormatted()

Since: 4.3.003 (2008-11-18)

Returns the current group page number formatted as a string.

See also

PaneNo()
formatPageNumber()

PageNoFormatted()

Since: 4.2.005 (2008-11-06)

Returns the current page number formatted as a string.

See also

PaneNo()
formatPageNumber()

protected _putocg()

Since: 3.0.000 (2008-03-27)

Put pdf layers.

startLayer(string $name = '', bool|null $print = true, bool $view = true, bool $lock = true)

Since: 5.9.102 (2011-07-13)

Start a new pdf layer.

Parameters

string $name

Layer name (only a-z letters and numbers). Leave empty for automatic name.

bool|null $print

Set to TRUE to print this layer, FALSE to not print and NULL to not set this option

bool $view

Set to true to view this layer.

bool $lock

If true lock the layer

endLayer()

Since: 5.9.102 (2011-07-13)

End the current PDF layer.

setVisibility(string $v)

Since: 3.0.000 (2008-03-27)

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

string $v

visibility mode. Legal values are: all, print, screen or view.

protected int|void addExtGState(array $parms)

Since: 3.0.000 (2008-03-27)

Add transparency parameters to the current extgstate

Parameters

array $parms parameters

Return Value

int|void

the number of extgstates

protected setExtGState(int $gs)

Since: 3.0.000 (2008-03-27)

Add an extgstate

Parameters

int $gs extgstate

protected _putextgstates()

Since: 3.0.000 (2008-03-27)

Put extgstates for object transparency

setOverprint(bool $stroking = true, bool|null $nonstroking = null, int $mode = 0)

Since: 5.9.152 (2012-03-23)

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

bool $stroking

If true apply overprint for stroking operations.

bool|null $nonstroking

If true apply overprint for painting operations other than stroking.

int $mode

Overprint mode: (0 = each source colour component value replaces the value previously painted for the corresponding device colorant; 1 = a tint value of 0.0 for a source colour component shall leave the corresponding component of the previously painted colour unchanged).

array<string,bool|int> getOverprint()

Since: 5.9.152 (2012-03-23)

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<string,bool|int>

setAlpha(float $stroking = 1, string $bm = 'Normal', float|null $nonstroking = null, bool $ais = false)

Since: 3.0.000 (2008-03-27)

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

Parameters

float $stroking

Alpha value for stroking operations: real value from 0 (transparent) to 1 (opaque).

string $bm

blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity

float|null $nonstroking

Alpha value for non-stroking operations: real value from 0 (transparent) to 1 (opaque).

bool $ais

array<string,bool|string> getAlpha()

Since: 5.9.152 (2012-03-23)

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<string,bool|string>

setJPEGQuality(int $quality)

Since: 3.0.000 (2008-03-27)

Set the default JPEG compression quality (1-100)

Parameters

int $quality

JPEG quality, integer between 1 and 100

setDefaultTableColumns(int $cols = 4)

Since: 3.0.014 (2008-06-04)

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

Parameters

int $cols

number of columns

setCellHeightRatio(float $h)

Since: 3.0.014 (2008-06-04)

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

Parameters

float $h

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

float getCellHeightRatio()

Since: 4.0.012 (2008-07-24)

return the height of cell repect font height.

Return Value

float

setPDFVersion(string $version = '1.7')

Since: 3.1.000 (2008-06-09)

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

Parameters

string $version

PDF document version.

setViewerPreferences(array $preferences)

Since: 3.1.000 (2008-06-09)

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

array $preferences

array of options.

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

Since: 4.9.000 (2010-03-26)

Paints color transition registration bars

Parameters

float $x

abscissa of the top left corner of the rectangle.

float $y

ordinate of the top left corner of the rectangle.

float $w

width of the rectangle.

float $h

height of the rectangle.

bool $transition

if true prints tcolor transitions to white.

bool $vertical

if true prints bar vertically.

string $colors

colors to print separated by comma. Valid values are: A,W,R,G,B,C,M,Y,K,RGB,CMYK,ALL,ALLSPOT,. Where: A = grayscale black, W = grayscale white, R = RGB red, G RGB green, B RGB blue, C = CMYK cyan, M = CMYK magenta, Y = CMYK yellow, K = CMYK key/black, RGB = RGB registration color, CMYK = CMYK registration color, ALL = Spot registration color, ALLSPOT = print all defined spot colors, = name of the spot color to print.

cropMark(float $x, float $y, float $w, float $h, string $type = 'T,R,B,L', array $color = array(100, 100, 100, 100, 'All'))

Since: 4.9.000 (2010-03-26)

Paints crop marks.

Parameters

float $x

abscissa of the crop mark center.

float $y

ordinate of the crop mark center.

float $w

width of the crop mark.

float $h

height of the crop mark.

string $type

type of crop mark, one symbol per type separated by comma: T = TOP, F = BOTTOM, L = LEFT, R = RIGHT, TL = A = TOP-LEFT, TR = B = TOP-RIGHT, BL = C = BOTTOM-LEFT, BR = D = BOTTOM-RIGHT.

array $color

crop mark color (default spot registration color).

registrationMark(float $x, float $y, float $r, bool $double = false, array $cola = array(100, 100, 100, 100, 'All'), array $colb = array(0, 0, 0, 0, 'None'))

Since: 4.9.000 (2010-03-26)

Paints a registration mark

Parameters

float $x

abscissa of the registration mark center.

float $y

ordinate of the registration mark center.

float $r

radius of the crop mark.

bool $double

if true print two concentric crop marks.

array $cola

crop mark color (default spot registration color 'All').

array $colb

second crop mark color (default spot registration color 'None').

registrationMarkCMYK(float $x, float $y, float $r)

Since: 6.0.038 (2013-09-30)

Paints a CMYK registration mark

Parameters

float $x

abscissa of the registration mark center.

float $y

ordinate of the registration mark center.

float $r

radius of the crop mark.

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

Since: 3.1.000 (2008-06-09)

Paints a linear colour gradient.

Parameters

float $x

abscissa of the top left corner of the rectangle.

float $y

ordinate of the top left corner of the rectangle.

float $w

width of the rectangle.

float $h

height of the rectangle.

array $col1

first color (Grayscale, RGB or CMYK components).

array $col2

second color (Grayscale, RGB or CMYK components).

array $coords

array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg). The default value is from left to right (x1=0, y1=0, x2=1, y2=0).

RadialGradient(float $x, float $y, float $w, float $h, array $col1 = array(), array $col2 = array(), array $coords = array(0.5, 0.5, 0.5, 0.5, 1))

Since: 3.1.000 (2008-06-09)

Paints a radial colour gradient.

Parameters

float $x

abscissa of the top left corner of the rectangle.

float $y

ordinate of the top left corner of the rectangle.

float $w

width of the rectangle.

float $h

height of the rectangle.

array $col1

first color (Grayscale, RGB or CMYK components).

array $col2

second color (Grayscale, RGB or CMYK components).

array $coords

array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1, (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg). (fx, fy) should be inside the circle, otherwise some areas will not be defined.

CoonsPatchMesh(float $x, float $y, float $w, float $h, array $col1 = array(), array $col2 = array(), array $col3 = array(), array $col4 = array(), 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), array $coords_min = 0, array $coords_max = 1, bool $antialias = false)

Since: 3.1.000 (2008-06-09)

Paints a coons patch mesh.

Parameters

float $x

abscissa of the top left corner of the rectangle.

float $y

ordinate of the top left corner of the rectangle.

float $w

width of the rectangle.

float $h

height of the rectangle.

array $col1

first color (lower left corner) (RGB components).

array $col2

second color (lower right corner) (RGB components).

array $col3

third color (upper right corner) (RGB components).

array $col4

fourth color (upper left corner) (RGB components).

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

minimum value used by the coordinates. If a coordinate's value is smaller than this it will be cut to coords_min. default: 0

array $coords_max

maximum value used by the coordinates. If a coordinate's value is greater than this it will be cut to coords_max. default: 1

bool $antialias

A flag indicating whether to filter the shading function to prevent aliasing artifacts.

protected Clip(float $x, float $y, float $w, float $h)

Since: 3.1.000 (2008-06-09)

Set a rectangular clipping area.

Parameters

float $x

abscissa of the top left corner of the rectangle (or top right corner for RTL mode).

float $y

ordinate of the top left corner of the rectangle.

float $w

width of the rectangle.

float $h

height of the rectangle.

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

Since: 3.1.000 (2008-06-09)

Output gradient.

Parameters

int $type

type of gradient (1 Function-based shading; 2 Axial shading; 3 Radial shading; 4 Free-form Gouraud-shaded triangle mesh; 5 Lattice-form Gouraud-shaded triangle mesh; 6 Coons patch mesh; 7 Tensor-product patch mesh). (Not all types are currently supported)

array $coords

array of coordinates.

array $stops

array gradient color components: color = array of GRAY, RGB or CMYK color components; offset = (0 to 1) represents a location along the gradient vector; exponent = exponent of the exponential interpolation function (default = 1).

array $background

An array of colour components appropriate to the colour space, specifying a single background colour value.

bool $antialias

A flag indicating whether to filter the shading function to prevent aliasing artifacts.

protected _putshaders()

Since: 3.1.000 (2008-06-09)

Output gradient shaders.

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

Since: 3.1.000 (2008-06-09)

Draw the sector of a circle.

It can be used for instance to render pie charts.

Parameters

float $xc

abscissa of the center.

float $yc

ordinate of the center.

float $r radius.
float $a

start angle (in degrees).

float $b

end angle (in degrees).

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

float $cw

indicates whether to go clockwise (default: true).

float $o

origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock). Default: 90.

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

Since: 3.1.000 (2008-06-09)

Draw the sector of an ellipse.

It can be used for instance to render pie charts.

Parameters

float $xc

abscissa of the center.

float $yc

ordinate of the center.

float $rx

the x-axis radius.

float $ry

the y-axis radius.

float $a

start angle (in degrees).

float $b

end angle (in degrees).

string $style

Style of rendering. See the getPathPaintOperator() function for more information.

float $cw

indicates whether to go clockwise.

float $o

origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock).

int $nc

Number of curves used to draw a 90 degrees portion of arc.

ImageEps(string $file, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, mixed $link = '', bool $useBoundingBox = true, string $align = '', string $palign = '', mixed $border = 0, bool $fitonpage = false, bool $fixoutvals = false)

Since: 3.1.000 (2008-06-09)

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

string $file

Name of the file containing the image or a '@' character followed by the EPS/AI data string.

float|null $x

Abscissa of the upper-left corner.

float|null $y

Ordinate of the upper-left corner.

float $w

Width of the image in the page. If not specified or equal to zero, it is automatically calculated.

float $h

Height of the image in the page. If not specified or equal to zero, it is automatically calculated.

mixed $link

URL or identifier returned by AddLink().

bool $useBoundingBox

specifies whether to position the bounding box (true) or the complete canvas (false) at location (x,y). Default value is true.

string $align

Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

string $palign

Allows to center or align the image on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

mixed $border

Indicates if borders must be drawn around the cell. The value can be a number:

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

bool $fitonpage

if true the image is resized to not exceed page dimensions.

bool $fixoutvals

if true remove values outside the bounding box.

setBarcode(string $bc = '')

Set document barcode.

Parameters

string $bc barcode

string getBarcode()

Since: 4.0.012 (2008-07-24)

Get current barcode.

Return Value

string

write1DBarcode(string $code, string $type, float|null $x = null, float|null $y = null, float|null $w = null, float|null $h = null, float|null $xres = null, array $style = array(), string $align = '')

Since: 3.1.000 (2008-06-09)

Print a Linear Barcode.

Parameters

string $code

code to print

string $type

type of barcode (see tcpdf_barcodes_1d.php for supported formats).

float|null $x

x position in user units (null = current x position)

float|null $y

y position in user units (null = current y position)

float|null $w

width in user units (null = remaining page width)

float|null $h

height in user units (null = remaining page height)

float|null $xres

width of the smallest bar in user units (null = default value = 0.4mm)

array $style

array of options:

  • boolean $style['border'] if true prints a border
  • int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)
  • int $style['hpadding'] horizontal padding in user units (set to 'auto' for automatic padding)
  • int $style['vpadding'] vertical padding in user units (set to 'auto' for automatic padding)
  • array $style['fgcolor'] color array for bars and text
  • mixed $style['bgcolor'] color array for background (set to false for transparent)
  • boolean $style['text'] if true prints text below the barcode
  • string $style['label'] override default label
  • string $style['font'] font name for text
  • int $style['fontsize'] font size for text
  • int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing.
  • string $style['position'] horizontal position of the containing barcode cell on the page: L = left margin; C = center; R = right margin.
  • string $style['align'] horizontal position of the barcode on the containing rectangle: L = left; C = center; R = right.
  • string $style['stretch'] if true stretch the barcode to best fit the available width, otherwise uses $xres resolution for a single bar.
  • string $style['fitwidth'] if true reduce the width to fit the barcode width + padding. When this option is enabled the 'stretch' option is automatically disabled.
  • string $style['cellfitalign'] this option works only when 'fitwidth' is true and 'position' is unset or empty. Set the horizontal position of the containing barcode cell inside the specified rectangle: L = left; C = center; R = right.
string $align

Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

write2DBarcode(string $code, string $type, float|null $x = null, float|null $y = null, float|null $w = null, float|null $h = null, array $style = array(), string $align = '', bool $distort = false)

Since: 4.5.037 (2009-04-07)

Print 2D Barcode.

Parameters

string $code

code to print

string $type

type of barcode (see tcpdf_barcodes_2d.php for supported formats).

float|null $x

x position in user units

float|null $y

y position in user units

float|null $w

width in user units

float|null $h

height in user units

array $style

array of options:

  • boolean $style['border'] if true prints a border around the barcode
  • int $style['padding'] padding to leave around the barcode in barcode units (set to 'auto' for automatic padding)
  • int $style['hpadding'] horizontal padding in barcode units (set to 'auto' for automatic padding)
  • int $style['vpadding'] vertical padding in barcode units (set to 'auto' for automatic padding)
  • int $style['module_width'] width of a single module in points
  • int $style['module_height'] height of a single module in points
  • array $style['fgcolor'] color array for bars and text
  • mixed $style['bgcolor'] color array for background or false for transparent
  • string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch
string $align

Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

bool $distort

if true distort the barcode to fit width and height, otherwise preserve aspect ratio

array getMargins()

Since: 3.2.000 (2008-06-23)

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

array getOriginalMargins()

Since: 4.0.012 (2008-07-24)

Returns an array containing original margins:

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

Return Value

array

containing all margins measures

float getFontSize()

Since: 3.2.000 (2008-06-23)

Returns the current font size.

Return Value

float

current font size

int getFontSizePt()

Since: 3.2.000 (2008-06-23)

Returns the current font size in points unit.

Return Value

int

current font size in points unit

string getFontFamily()

Since: 4.3.008 (2008-12-05)

Returns the current font family name.

Return Value

string

current font family name

string getFontStyle()

Since: 4.3.008 (2008-12-05)

Returns the current font style.

Return Value

string

current font style

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

Since: 5.9.017 (2010-11-16)

Cleanup HTML code (requires HTML Tidy library).

Parameters

string $html

htmlcode to fix

string $default_css

CSS commands to add

array|null $tagvs

parameters for setHtmlVSpace method

array|null $tidy_options

options for tidy_parse_string function

Return Value

string

XHTML code cleaned up

See also

setHtmlVSpace()

protected int getCSSBorderWidth(string $width)

Since: 5.7.000 (2010-08-02)

Returns the border width from CSS property

Parameters

string $width

border width

Return Value

int

with in user units

protected int getCSSBorderDashStyle(string $style)

Since: 5.7.000 (2010-08-02)

Returns the border dash style from CSS property

Parameters

string $style

border style to convert

Return Value

int

sash style (return -1 in case of none or hidden border)

protected array getCSSBorderStyle(string $cssborder)

Since: 5.7.000 (2010-08-02)

Returns the border style array from CSS border properties

Parameters

string $cssborder

border properties

Return Value

array

containing border properties

array getCSSPadding(string $csspadding, float $width = 0)

Since: 5.9.000 (2010-10-04)

Get the internal Cell padding from CSS attribute.

Parameters

string $csspadding

padding properties

float $width

width of the containing element

Return Value

array

of cell paddings

array getCSSMargin(string $cssmargin, float $width = 0)

Since: 5.9.000 (2010-10-04)

Get the internal Cell margin from CSS attribute.

Parameters

string $cssmargin

margin properties

float $width

width of the containing element

Return Value

array

of cell margins

array getCSSBorderMargin(string $cssbspace, float $width = 0)

Since: 5.9.010 (2010-10-27)

Get the border-spacing from CSS attribute.

Parameters

string $cssbspace

border-spacing CSS properties

float $width

width of the containing element

Return Value

array

of border spacings

protected float getCSSFontSpacing(string $spacing, float $parent = 0)

Since: 5.9.000 (2010-10-02)

Returns the letter-spacing value from CSS value

Parameters

string $spacing

letter-spacing value

float $parent

font spacing (tracking) value of the parent element

Return Value

float

quantity to increases or decreases the space between characters in a text.

protected float getCSSFontStretching(string $stretch, float $parent = 100)

Since: 5.9.000 (2010-10-02)

Returns the percentage of font stretching from CSS value

Parameters

string $stretch

stretch mode

float $parent

stretch value of the parent element

Return Value

float

font stretching percentage

float getHTMLFontUnits(string $val, float $refsize = 12, float $parent_size = 12, string $defaultunit = 'pt')

Convert HTML string containing font size value to points

Parameters

string $val

String containing font size value and unit.

float $refsize

Reference font size in points.

float $parent_size

Parent font size in points.

string $defaultunit

Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt).

Return Value

float

value in points

protected array getHtmlDomArray(string $html)

Since: 3.2.000 (2008-06-20)

Returns the HTML DOM array.

Parameters

string $html

html code

Return Value

array

protected string getSpaceString()

Since: 4.8.024 (2010-01-15)

Returns the string used to find spaces

Return Value

string

protected string hashTCPDFtag(string $data)

Calculates the hash value of the given data.

Parameters

string $data

The data to be hashed.

Return Value

string

The hashed value of the data.

string serializeTCPDFtag(string $method, array $params = array())

Serialize data to be used with TCPDF tag in HTML code.

Parameters

string $method

TCPDF method name

array $params

Method parameters

Return Value

string

Serialized data

protected array unserializeTCPDFtag(string $data)

Unserialize data to be used with TCPDF tag in HTML code.

Parameters

string $data

serialized data

Return Value

array

containing unserialized data

protected bool allowedTCPDFtag(string $method)

Check if a TCPDF tag is allowed

Parameters

string $method

TCPDF method name

Return Value

bool

writeHTMLCell(float $w, float $h, float|null $x, float|null $y, string $html = '', mixed $border = 0, int $ln = 0, bool $fill = false, bool $reseth = true, string $align = '', bool $autopadding = true)

Prints a cell (rectangular area) with optional borders, background color and html text string.

The upper-left corner of the cell corresponds to the current position. After the call, the current position moves to the right or to the next line.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting. IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting. Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul NOTE: all the HTML attributes must be enclosed in double-quote.

Parameters

float $w

Cell width. If 0, the cell extends up to the right margin.

float $h

Cell minimum height. The cell extends automatically if needed.

float|null $x

upper-left corner X coordinate

float|null $y

upper-left corner Y coordinate

string $html

html text to print. Default value: empty string.

mixed $border

Indicates if borders must be drawn around the cell. The value can be a number:

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

int $ln

Indicates where the current position should go after the call. Possible values are:

  • 0: to the right (or left for RTL language)
  • 1: to the beginning of the next line
  • 2: below
Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.

bool $fill

Indicates if the cell background must be painted (true) or transparent (false).

bool $reseth

if true reset the last cell height (default true).

string $align

Allows to center or align the text. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

bool $autopadding

if true, uses internal padding and automatically adjust it to account for line width.

See also

Multicell()
writeHTML()

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

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

Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul NOTE: all the HTML attributes must be enclosed in double-quote.

Parameters

string $html

text to display

bool $ln

if true add a new line after text (default = true)

bool $fill

Indicates if the background must be painted (true) or transparent (false).

bool $reseth

if true reset the last cell height (default false).

bool $cell

if true add the current left (or right for RTL) padding to each Write (default false).

string $align

Allows to center or align the text. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

protected array openHTMLTagHandler(array $dom, int $key, bool $cell)

Process opening tags.

Parameters

array $dom

html dom array

int $key

current element id

bool $cell

if true add the default left (or right if RTL) padding to each new line (default false).

Return Value

array $dom

protected array closeHTMLTagHandler(array $dom, int $key, bool $cell, int $maxbottomliney = 0)

Process closing tags.

Parameters

array $dom

html dom array

int $key

current element id

bool $cell

if true add the default left (or right if RTL) padding to each new line (default false).

int $maxbottomliney

maximum y value of current line

Return Value

array $dom

protected addHTMLVertSpace(string $hbz = 0, string $hb = 0, bool $cell = false, bool $firsttag = false, bool $lasttag = false)

Add vertical spaces if needed.

Parameters

string $hbz

Distance between current y and line bottom.

string $hb

The height of the break.

bool $cell

if true add the default left (or right if RTL) padding to each new line (default false).

bool $firsttag

set to true when the tag is the first.

bool $lasttag

set to true when the tag is the last.

protected array getBorderStartPosition()

Since: 5.7.000 (2010-08-03)

Return the starting coordinates to draw an html border

Return Value

array

containing top-left border coordinates

protected drawHTMLTagBorder(array $tag, int $xmax)

Since: 5.7.000 (2010-08-03)

Draw an HTML block border and fill

Parameters

array $tag

array of tag properties.

int $xmax

end X coordinate for border.

setLIsymbol(string $symbol = '!')

Since: 4.0.028 (2008-09-26)

Set the default bullet to be used as LI bullet symbol

Parameters

string $symbol

character or string to be used (legal values are: '' = automatic, '!' = auto bullet, '#' = auto numbering, 'disc', 'disc', 'circle', 'square', '1', 'decimal', 'decimal-leading-zero', 'i', 'lower-roman', 'I', 'upper-roman', 'a', 'lower-alpha', 'lower-latin', 'A', 'upper-alpha', 'upper-latin', 'lower-greek', 'img|type|width|height|image.ext')

setBooklet(bool $booklet = true, float $inner = -1, float $outer = -1)

Since: 4.2.000 (2008-10-29)

Set the booklet mode for double-sided pages.

Parameters

bool $booklet

true set the booklet mode on, false otherwise.

float $inner

Inner page margin.

float $outer

Outer page margin.

protected swapMargins(bool $reverse = true)

Since: 4.2.000 (2008-10-29)

Swap the left and right margins.

Parameters

bool $reverse

if true swap left and right margins.

setHtmlVSpace(array $tagvs)

Since: 4.2.001 (2008-10-30)

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

array $tagvs

array of tags and relative vertical spaces.

setListIndentWidth(float $width)

Since: 4.2.007 (2008-11-12)

Set custom width for list indentation.

Parameters

float $width

width of the indentation. Use negative value to disable it.

setOpenCell(bool $isopen)

Since: 4.2.010 (2008-11-14)

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

Parameters

bool $isopen

if true keeps the top/bottom border open for the cell sides that cross the page.

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

Since: 4.4.003 (2008-12-09)

Set the color and font style for HTML links.

Parameters

array $color

RGB array of colors

string $fontstyle

additional font styles to add

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

Since: 4.4.004 (2008-12-10)

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

Parameters

string $htmlval

String containing values and unit.

string $refsize

Reference value in points.

string $defaultunit

Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt).

bool $points

If true returns points, otherwise returns value in user's units.

Return Value

float

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

protected putHtmlListBullet(int $listdepth, string $listtype = '', float $size = 10)

Since: 4.4.004 (2008-12-10)

Output an HTML list bullet or ordered item symbol

Parameters

int $listdepth

list nesting level

string $listtype

type of list

float $size

current font size

protected array getGraphicVars()

Since: 4.2.010 (2008-11-14)

Returns current graphic variables as array.

Return Value

array

of graphic variables

protected setGraphicVars(array $gvars, bool $extended = false)

Since: 4.2.010 (2008-11-14)

Set graphic variables.

Parameters

array $gvars

array of graphic variablesto restore

bool $extended

if true restore extended graphic variables

protected _outSaveGraphicsState()

Outputs the "save graphics state" operator 'q'

protected _outRestoreGraphicsState()

Outputs the "restore graphics state" operator 'Q'

protected setBuffer(string $data)

Since: 4.5.000 (2009-01-02)

Set buffer content (always append data).

Parameters

string $data data

protected replaceBuffer(string $data)

Since: 5.5.000 (2010-06-22)

Replace the buffer content

Parameters

string $data data

protected string getBuffer()

Since: 4.5.000 (2009-01-02)

Get buffer content.

Return Value

string

buffer content

protected setPageBuffer(int $page, string $data, bool $append = false)

Since: 4.5.000 (2008-12-31)

Set page buffer content.

Parameters

int $page

page number

string $data

page data

bool $append

if true append data, false replace.

protected string getPageBuffer(int $page)

Since: 4.5.000 (2008-12-31)

Get page buffer content.

Parameters

int $page

page number

Return Value

string

page buffer content or false in case of error

protected int setImageBuffer(string $image, array $data)

Since: 4.5.000 (2008-12-31)

Set image buffer content.

Parameters

string $image

image key

array $data

image data

Return Value

int

image index number

protected setImageSubBuffer(string $image, string $key, array $data)

Since: 4.5.000 (2008-12-31)

Set image buffer content for a specified sub-key.

Parameters

string $image

image key

string $key

image sub-key

array $data

image data

protected string|false getImageBuffer(string $image)

Since: 4.5.000 (2008-12-31)

Get image buffer content.

Parameters

string $image

image key

Return Value

string|false

image buffer content or false in case of error

protected setFontBuffer(string $font, array $data)

Since: 4.5.000 (2009-01-02)

Set font buffer content.

Parameters

string $font

font key

array $data

font data

protected setFontSubBuffer(string $font, string $key, mixed $data)

Since: 4.5.000 (2009-01-02)

Set font buffer content.

Parameters

string $font

font key

string $key

font sub-key

mixed $data

font data

protected string|false getFontBuffer(string $font)

Since: 4.5.000 (2009-01-02)

Get font buffer content.

Parameters

string $font

font key

Return Value

string|false

font buffer content or false in case of error

bool movePage(int $frompage, int $topage)

Since: 4.5.000 (2009-01-02)

Move a page to a previous position.

Parameters

int $frompage

number of the source page

int $topage

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

Return Value

bool

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

bool deletePage(int $page)

Since: 4.6.004 (2009-04-23)

Remove the specified page.

Parameters

int $page

page to remove

Return Value

bool

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

bool copyPage(int $page = 0)

Since: 4.9.015 (2010-04-20)

Clone the specified page to a new page.

Parameters

int $page

number of page to copy (0 = current page)

Return Value

bool

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

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

Since: 4.5.000 (2009-01-02)

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

int|null $page

page number where this TOC should be inserted (leave empty for current page).

string $numbersfont

set the font for page numbers (please use monospaced font for better alignment).

string $filler

string used to fill the space between text and page number.

string $toc_name

name to use for TOC bookmark.

string $style

Font style for title: B = Bold, I = Italic, BI = Bold + Italic.

array $color

RGB color array for bookmark title (values from 0 to 255).

See also

addTOCPage()
endTOCPage()
addHTMLTOC()

addHTMLTOC(int|null $page = null, string $toc_name = 'TOC', array $templates = array(), bool $correct_align = true, string $style = '', array $color = array(0, 0, 0))

Since: 5.0.001 (2010-05-06)

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

int|null $page

page number where this TOC should be inserted (leave empty for current page).

string $toc_name

name to use for TOC bookmark.

array $templates

array of html templates. Use: "#TOC_DESCRIPTION#" for bookmark title, "#TOC_PAGE_NUMBER#" for page number.

bool $correct_align

if true correct the number alignment (numbers must be in monospaced font like courier and right aligned on LTR, or left aligned on RTL)

string $style

Font style for title: B = Bold, I = Italic, BI = Bold + Italic.

array $color

RGB color array for title (values from 0 to 255).

See also

addTOCPage()
endTOCPage()
addTOC()

startTransaction()

Since: 4.5.029 (2009-03-19)

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

commitTransaction()

Since: 4.5.029 (2009-03-19)

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

TCPDF rollbackTransaction(bool $self = false)

Since: 4.5.029 (2009-03-19)

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

Parameters

bool $self

if true restores current class object to previous state without the need of reassignment via the returned value.

Return Value

TCPDF object.

setEqualColumns(int $numcols = 0, int $width = 0, int|null $y = null)

Since: 4.9.001 (2010-03-28)

Set multiple columns of the same size

Parameters

int $numcols

number of columns (set to zero to disable columns mode)

int $width

column width

int|null $y

column starting Y position (leave empty for current Y position)

resetColumns()

Since: 5.9.072 (2011-04-26)

Remove columns and reset page margins.

setColumnsArray(array $columns)

Since: 4.9.001 (2010-03-28)

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

array $columns

selectColumn(int|null $col = null)

Since: 4.9.001 (2010-03-28)

Set position at a given column

Parameters

int|null $col

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

int getColumn()

Since: 5.5.011 (2010-07-08)

Return the current column number

Return Value

int

current column number

int getNumberOfColumns()

Since: 5.8.018 (2010-08-25)

Return the current number of columns.

Return Value

int

number of columns

setTextRenderingMode(int $stroke = 0, bool $fill = true, bool $clip = false)

Since: 4.9.008 (2009-04-02)

Set Text rendering mode.

Parameters

int $stroke

outline size in user units (0 = disable).

bool $fill

if true fills the text (default).

bool $clip

if true activate clipping mode

setTextShadow(array $params = array('enabled' => false, 'depth_w' => 0, 'depth_h' => 0, 'color' => false, 'opacity' => 1, 'blend_mode' => 'Normal'))

Since: 5.9.174 (2012-07-25)

Set parameters for drop shadow effect for text.

Parameters

array $params

Array of parameters: enabled (boolean) set to true to enable shadow; depth_w (float) shadow width in user units; depth_h (float) shadow height in user units; color (array) shadow color or false to use the stroke color; opacity (float) Alpha value: real value from 0 (transparent) to 1 (opaque); blend_mode (string) blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity.

array getTextShadow()

Since: 5.9.174 (2012-07-25)

Return the text shadow parameters array.

Return Value

array

array of parameters.

protected array hyphenateWord(array $word, array $patterns, array $dictionary = array(), int $leftmin = 1, int $rightmin = 2, int $charmin = 1, int $charmax = 8)

Since: 4.9.012 (2010-04-12)

Returns an array of chars containing soft hyphens.

Parameters

array $word

array of chars

array $patterns

Array of hypenation patterns.

array $dictionary

Array of words to be returned without applying the hyphenation algorithm.

int $leftmin

Minimum number of character to leave on the left of the word without applying the hyphens.

int $rightmin

Minimum number of character to leave on the right of the word without applying the hyphens.

int $charmin

Minimum word length to apply the hyphenation algorithm.

int $charmax

Maximum length of broken piece of word.

Return Value

array

text with soft hyphens

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

Since: 4.9.012 (2010-04-12)

Returns text with soft hyphens.

Parameters

string $text

text to process

mixed $patterns

Array of hypenation patterns or a TEX file containing hypenation patterns. TEX patterns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/

array $dictionary

Array of words to be returned without applying the hyphenation algorithm.

int $leftmin

Minimum number of character to leave on the left of the word without applying the hyphens.

int $rightmin

Minimum number of character to leave on the right of the word without applying the hyphens.

int $charmin

Minimum word length to apply the hyphenation algorithm.

int $charmax

Maximum length of broken piece of word.

Return Value

string

text with soft hyphens

setRasterizeVectorImages(bool $mode)

Since: 5.0.000 (2010-04-27)

Enable/disable rasterization of vector images using ImageMagick library.

Parameters

bool $mode

if true enable rasterization, false otherwise.

setFontSubsetting(bool $enable = true)

Since: 5.3.002 (2010-06-07)

Enable or disable default option for font subsetting.

Parameters

bool $enable

if true enable font subsetting by default.

bool getFontSubsetting()

Since: 5.3.002 (2010-06-07)

Return the default option for font subsetting.

Return Value

bool

default font subsetting state.

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

Since: 5.8.000 (2010-08-11)

Left trim the input string

Parameters

string $str

string to trim

string $replace

string that replace spaces.

Return Value

string

left trimmed string

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

Since: 5.8.000 (2010-08-11)

Right trim the input string

Parameters

string $str

string to trim

string $replace

string that replace spaces.

Return Value

string

right trimmed string

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

Since: 5.8.000 (2010-08-11)

Trim the input string

Parameters

string $str

string to trim

string $replace

string that replace spaces.

Return Value

string

trimmed string

bool isUnicodeFont()

Since: 5.8.002 (2010-08-14)

Return true if the current font is unicode type.

Return Value

bool

true for unicode font, false otherwise.

string getFontFamilyName(string $fontfamily)

Since: 5.8.004 (2010-08-17)

Return normalized font name

Parameters

string $fontfamily

property string containing font family names

Return Value

string

normalized font name

string|false startTemplate(int $w = 0, int $h = 0, mixed $group = false)

Since: 5.8.017 (2010-08-24)

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

int $w

Template width in user units (empty string or zero = page width less margins).

int $h

Template height in user units (empty string or zero = page height less margins).

mixed $group

Set transparency group. Can be a boolean value or an array specifying optional parameters: 'CS' (solour space name), 'I' (boolean flag to indicate isolated group) and 'K' (boolean flag to indicate knockout group).

Return Value

string|false

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

See also

endTemplate()
printTemplate()

string|false endTemplate()

Since: 5.8.017 (2010-08-24)

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

string|false

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

See also

startTemplate()
printTemplate()

printTemplate(string $id, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, string $align = '', string $palign = '', bool $fitonpage = false)

Since: 5.8.017 (2010-08-24)

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

string $id

The ID of XObject Template to print.

float|null $x

X position in user units (empty string = current x position)

float|null $y

Y position in user units (empty string = current y position)

float $w

Width in user units (zero = remaining page width)

float $h

Height in user units (zero = remaining page height)

string $align

Indicates the alignment of the pointer next to template insertion relative to template height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

string $palign

Allows to center or align the template on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

bool $fitonpage

If true the template is resized to not exceed page dimensions.

See also

startTemplate()
endTemplate()

setFontStretching(int $perc = 100)

Since: 5.9.000 (2010-09-29)

Set the percentage of character stretching.

Parameters

int $perc

percentage of stretching (100 = no stretching)

float getFontStretching()

Since: 5.9.000 (2010-09-29)

Get the percentage of character stretching.

Return Value

float

stretching value

setFontSpacing(float $spacing = 0)

Since: 5.9.000 (2010-09-29)

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

Parameters

float $spacing

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

int getFontSpacing()

Since: 5.9.000 (2010-09-29)

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

Return Value

int

font spacing (tracking) value

array getPageRegions()

Since: 5.9.003 (2010-10-13)

Return an array of no-write page regions

Return Value

array

of no-write page regions

See also

setPageRegions()
addPageRegion()

setPageRegions(array $regions = array())

Since: 5.9.003 (2010-10-13)

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

array $regions

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

addPageRegion(array $region)

Since: 5.9.003 (2010-10-13)

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

array $region

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

removePageRegion(int $key)

Since: 5.9.003 (2010-10-13)

Remove a single no-write region.

Parameters

int $key

region key

See also

setPageRegions()
getPageRegions()

protected float[] checkPageRegions(float $h, float $x, float $y)

Since: 5.9.003 (2010-10-13)

Check page for no-write regions and adapt current coordinates and page margins if necessary.

A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. A region is always aligned on the left or right side of the page ad is defined using a vertical segment.

Parameters

float $h

height of the text/image/object to print in user units

float $x

current X coordinate in user units

float $y

current Y coordinate in user units

Return Value

float[]

array($x, $y)

ImageSVG(string $file, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, mixed $link = '', string $align = '', string $palign = '', mixed $border = 0, bool $fitonpage = false)

Since: 5.0.000 (2010-05-02)

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

string $file

Name of the SVG file or a '@' character followed by the SVG data string.

float|null $x

Abscissa of the upper-left corner.

float|null $y

Ordinate of the upper-left corner.

float $w

Width of the image in the page. If not specified or equal to zero, it is automatically calculated.

float $h

Height of the image in the page. If not specified or equal to zero, it is automatically calculated.

mixed $link

URL or identifier returned by AddLink().

string $align

Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line
If the alignment is an empty string, then the pointer will be restored on the starting SVG position.

string $palign

Allows to center or align the image on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

mixed $border

Indicates if borders must be drawn around the cell. The value can be a number:

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

bool $fitonpage

if true the image is resized to not exceed page dimensions.

protected array convertSVGtMatrix(array $tm)

Since: 5.0.000 (2010-05-02)

Convert SVG transformation matrix to PDF.

Parameters

array $tm

original SVG transformation matrix

Return Value

array

transformation matrix

protected SVGTransform(array $tm)

Since: 5.0.000 (2010-05-02)

Apply SVG graphic transformation matrix.

Parameters

array $tm

original SVG transformation matrix

protected string setSVGStyles(array $svgstyle, array $prevsvgstyle, int $x = 0, int $y = 0, int $w = 1, int $h = 1, string $clip_function = '', array $clip_params = array())

Since: 5.0.000 (2010-05-02)

Apply the requested SVG styles ( TO BE COMPLETED )

Parameters

array $svgstyle

array of SVG styles to apply

array $prevsvgstyle

array of previous SVG style

int $x

X origin of the bounding box

int $y

Y origin of the bounding box

int $w

width of the bounding box

int $h

height of the bounding box

string $clip_function

clip function

array $clip_params

array of parameters for clipping function

Return Value

string style

protected array SVGPath(string $d, string $style = '')

Since: 5.0.000 (2010-05-02)

Draws an SVG path

Parameters

string $d

attribute d of the path SVG element

string $style

Style of rendering. Possible values are:

  • D or empty string: Draw (default).
  • F: Fill.
  • F*: Fill using the even-odd rule to determine which regions lie inside the clipping path.
  • DF or FD: Draw and fill.
  • DF* or FD*: Draw and fill using the even-odd rule to determine which regions lie inside the clipping path.
  • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
  • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).

Return Value

array

of container box measures (x, y, w, h)

protected removeTagNamespace(string $name)

Return the tag name without the namespace

Parameters

string $name

Tag name

protected startSVGElementHandler(resource|string $parser, string $name, array $attribs, array $ctm = array())

Since: 5.0.000 (2010-05-02)

Sets the opening SVG element handler function for the XML parser. ( TO BE COMPLETED )

Parameters

resource|string $parser

The first parameter, parser, is a reference to the XML parser calling the handler.

string $name

The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.

array $attribs

The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on.

array $ctm

tranformation matrix for clipping mode (starting transformation matrix).

protected endSVGElementHandler(resource|string $parser, string $name)

Since: 5.0.000 (2010-05-02)

Sets the closing SVG element handler function for the XML parser.

Parameters

resource|string $parser

The first parameter, parser, is a reference to the XML parser calling the handler.

string $name

The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.

protected segSVGContentHandler(resource $parser, string $data)

Since: 5.0.000 (2010-05-02)

Sets the character data handler function for the XML parser.

Parameters

resource $parser

The first parameter, parser, is a reference to the XML parser calling the handler.

string $data

The second parameter, data, contains the character data as a string.

protected string getCachedFileContents(string $file)

Keeps files in memory, so it doesn't need to downloaded everytime in a loop

Parameters

string $file

Return Value

string

protected bool fileExists(string $file)

Avoid multiple calls to an external server to see if a file exists

Parameters

string $file

Return Value

bool

void importPDF(string $filename)

Since: 1.0.000 (2011-05-24)

Import an existing PDF document

Parameters

string $filename

Filename of the PDF document to import.

Return Value

void