TOC_TCPDF

Extends\TCPDF

TCPDF class extension with custom header and footer for TOC page

package

com.tecnick.tcpdf

Methods

This is the class constructor.

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

It allows to set up the page format, the orientation and the measure unit used in all the methods (except for the font sizes).

public
see \getPageSizeFromFormat(),

setPageFormat()

Arguments

$orientation

string

page orientation. Possible values are (case insensitive):

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

$unit

string

User measure unit. Possible values are:

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

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

$format

mixed

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

$unicode

boolean

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

$encoding

string

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

$diskcache

boolean

DEPRECATED FEATURE

$pdfa

false|integer

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

Default destructor.

__destruct()
inherited
public
since 1.53.0.TC016

Adds a javascript form field.

_addfield(string $type,string $name,integer $x,integer $y,integer $w,integer $h,array $prop)
inherited
protected
author

Denis Van Nuffelen, Nicola Asuni

since 2.1.002

(2008-02-12)

Arguments

$type

string

field type

$name

string

field name

$x

integer

horizontal position

$y

integer

vertical position

$w

integer

width

$h

integer

height

$prop

array

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

Initialize a new page.

_beginpage(string $orientation = '',mixed $format = '')
inherited
protected
see \getPageSizeFromFormat(),

setPageFormat()

Arguments

$orientation

string

page orientation. Possible values are (case insensitive):

  • P or PORTRAIT (default)
  • L or LANDSCAPE

$format

mixed

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

Format a data string for meta information

_datastring(string $s,integer $n): string
inherited
protected

Arguments

$s

string

data string to escape.

$n

integer

object ID

Response

string

escaped string.

Returns a formatted date for meta information

_datestring(integer $n,integer $timestamp): string
inherited
protected
since 4.6.028

(2009-08-25)

Arguments

$n

integer

Object ID.

$timestamp

integer

Timestamp to convert.

Response

string

escaped date string.

Unset all class variables except the following critical variables.

_destroy(boolean $destroyall = false,boolean $preserve_objcopy = false)
inherited
public
since 4.5.016

(2009-02-24)

Arguments

$destroyall

boolean

if true destroys all class variables, otherwise preserves critical variables.

$preserve_objcopy

boolean

if true preserves the objcopy variable

Check for locale-related bug

_dochecks()
inherited
protected

Line through text.

_dolinethrough(integer $x,integer $y,string $txt)
inherited
protected

Arguments

$x

integer

X coordinate

$y

integer

Y coordinate

$txt

string

text to linethrough

Line through for rectangular text area.

_dolinethroughw(integer $x,integer $y,integer $w)
inherited
protected
since 4.9.008

(2009-09-29)

Arguments

$x

integer

X coordinate

$y

integer

Y coordinate

$w

integer

line length (width)

Overline text.

_dooverline(integer $x,integer $y,string $txt)
inherited
protected
since 4.9.015

(2010-04-19)

Arguments

$x

integer

X coordinate

$y

integer

Y coordinate

$txt

string

text to overline

Overline for rectangular text area.

_dooverlinew(integer $x,integer $y,integer $w)
inherited
protected
since 4.9.015

(2010-04-19)

Arguments

$x

integer

X coordinate

$y

integer

Y coordinate

$w

integer

width to overline

Underline text.

_dounderline(integer $x,integer $y,string $txt)
inherited
protected

Arguments

$x

integer

X coordinate

$y

integer

Y coordinate

$txt

string

text to underline

Underline for rectangular text area.

_dounderlinew(integer $x,integer $y,integer $w)
inherited
protected
since 4.8.008

(2009-09-29)

Arguments

$x

integer

X coordinate

$y

integer

Y coordinate

$w

integer

width to underline

Encrypt the input string.

_encrypt_data(integer $n,string $s): string
inherited
protected
author

Nicola Asuni

since 5.0.005

(2010-05-11)

Arguments

$n

integer

object number

$s

string

data string to encrypt

Response

string

encrypted string

Output end of document (EOF).

_enddoc()
inherited
protected

Mark end of page.

_endpage()
inherited
protected

Convert password for AES-256 encryption mode

_fixAES256Password(string $password): string
inherited
protected
since 5.9.006

(2010-10-19)

author

Nicola Asuni

Arguments

$password

string

password

Response

string

password

Compute encryption key

_generateencryptionkey()
inherited
protected
since 2.0.000

(2008-01-02)

author

Nicola Asuni

Get references to page annotations.

_getannotsrefs(integer $n): string
inherited
protected
author

Nicola Asuni

since 5.0.010

(2010-05-17)

Arguments

$n

integer

page number

Response

string

Return the starting object string for the selected object ID.

_getobj(integer|null $objid = null): string
inherited
protected
since 5.8.009

(2010-08-20)

Arguments

$objid

integer|null

Object ID (leave empty to get a new ID).

Response

string

the starting object string

get raw output stream.

_getrawstream(string $s,integer $n)
inherited
protected
author

Nicola Asuni

since 5.5.000

(2010-06-22)

Arguments

$s

string

string to output.

$n

integer

object reference for encryption mode

Return XObjects Dictionary.

_getxobjectdict(): string
inherited
protected
since 5.8.014

(2010-08-23)

Response

string

XObjects dictionary

Begin a new object and return the object number.

_newobj(): integer
inherited
protected

Response

integer

object number

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

_objectkey(integer $n): integer
inherited

This is used for all strings and streams without crypt filter specifier.

protected
author

Nicola Asuni

since 2.0.000

(2008-01-02)

Arguments

$n

integer

object number

Response

integer

object key

Compute OE value (used for encryption)

_OEvalue(): string
inherited
protected
since 5.9.006

(2010-10-19)

author

Nicola Asuni

Response

string

OE value

Output a string to the document.

_out(string $s)
inherited
protected

Arguments

$s

string

string to output.

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.

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

The new current point shall be (x3, y3).

protected
since 2.1.000

(2008-01-08)

Arguments

$x1

float

Abscissa of control point 1.

$y1

float

Ordinate of control point 1.

$x2

float

Abscissa of control point 2.

$y2

float

Ordinate of control point 2.

$x3

float

Abscissa of end point.

$y3

float

Ordinate of end point.

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.

_outCurveV(float $x2,float $y2,float $x3,float $y3)
inherited

The new current point shall be (x3, y3).

protected
since 4.9.019

(2010-04-26)

Arguments

$x2

float

Abscissa of control point 2.

$y2

float

Ordinate of control point 2.

$x3

float

Abscissa of end point.

$y3

float

Ordinate of end point.

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.

_outCurveY(float $x1,float $y1,float $x3,float $y3)
inherited

The new current point shall be (x3, y3).

protected
since 2.1.000

(2008-01-08)

Arguments

$x1

float

Abscissa of control point 1.

$y1

float

Ordinate of control point 1.

$x3

float

Abscissa of end point.

$y3

float

Ordinate of end point.

Append an elliptical arc to the current path.

_outellipticalarc(float $xc,float $yc,float $rx,float $ry,float $xang,float $angs,float $angf = 360,boolean $pie = false,integer $nc = 2,boolean $startpoint = true,boolean $ccw = true,boolean $svg = false): array
inherited

An ellipse is formed from n Bezier curves.

author

Nicola Asuni

protected
since 4.9.019

(2010-04-26)

Arguments

$xc

float

Abscissa of center point.

$yc

float

Ordinate of center point.

$rx

float

Horizontal radius.

$ry

float

Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0.

$xang

float

Angle between the X-axis and the major axis of the ellipse. Default value: 0.

$angs

float

Angle start of draw line. Default value: 0.

$angf

float

Angle finish of draw line. Default value: 360.

$pie

boolean

if true do not mark the border point (used to draw pie sectors).

$nc

integer

Number of curves used to draw a 90 degrees portion of ellipse.

$startpoint

boolean

if true output a starting point.

$ccw

boolean

if true draws in counter-clockwise.

$svg

boolean

if true the angles are in svg mode (already calculated).

Response

array

bounding box coordinates (x min, y min, x max, y max)

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

_outLine(float $x,float $y)
inherited

The new current point shall be (x, y).

protected
since 2.1.000

(2008-01-08)

Arguments

$x

float

Abscissa of end point.

$y

float

Ordinate of end point.

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

_outPoint(float $x,float $y)
inherited
protected
since 2.1.000

(2008-01-08)

Arguments

$x

float

Abscissa of point.

$y

float

Ordinate of point.

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

_outRect(float $x,float $y,float $w,float $h,string $op)
inherited
protected
since 2.1.000

(2008-01-08)

Arguments

$x

float

Abscissa of upper-left corner.

$y

float

Ordinate of upper-left corner.

$w

float

Width.

$h

float

Height.

$op

string

options

Outputs the "restore graphics state" operator 'Q'

_outRestoreGraphicsState()
inherited
protected

Outputs the "save graphics state" operator 'q'

_outSaveGraphicsState()
inherited
protected

Compute O value (used for encryption)

_Ovalue(): string
inherited
protected
since 2.0.000

(2008-01-02)

author

Nicola Asuni

Response

string

O value

Output annotations objects for all pages.

_putannotsobjs()
inherited

!!! THIS METHOD IS NOT YET COMPLETED !!! See section 12.5 of PDF 32000_2008 reference.

protected
author

Nicola Asuni

since 4.0.018

(2008-08-06)

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

_putAPXObject(integer $w,integer $h,string $stream = ''): integer
inherited
protected
since 4.8.001

(2009-09-09)

Arguments

$w

integer

annotation width

$h

integer

annotation height

$stream

string

appearance stream

Response

integer

object ID

Create a bookmark PDF string.

_putbookmarks()
inherited
protected
author

Olivier Plathey, Nicola Asuni

since 2.1.002

(2008-02-12)

Output Catalog.

_putcatalog(): integer
inherited
protected

Response

integer

object id

Output CID-0 fonts.

_putcidfont0(array $font)
inherited

A Type 0 CIDFont contains glyph descriptions based on the Adobe Type 1 font format

protected
author

Andrew Whitehead, Nicola Asuni, Yukihiro Nakadaira

since 3.2.000

(2008-06-23)

Arguments

$font

array

font data

Insert Named Destinations.

_putdests()
inherited
protected
author

Johannes G\FCntert, Nicola Asuni

since 5.9.098

(2011-06-23)

Embedd the attached files.

_putEmbeddedFiles()
inherited
since 4.4.000

(2008-12-07)

protected
see \TCPDF::Annotation()

Put encryption on PDF document.

_putencryption()
inherited
protected
author

Nicola Asuni

since 2.0.000

(2008-01-02)

Put extgstates for object transparency

_putextgstates()
inherited
protected
since 3.0.000

(2008-03-27)

Output fonts.

_putfonts()
inherited
author

Nicola Asuni

protected

Output PDF File Header (7.5.2).

_putheader()
inherited
protected

Output images.

_putimages()
inherited
protected

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

_putinfo(): integer
inherited
protected

Response

integer

object id

Create a javascript PDF string.

_putjavascript()
inherited
protected
author

Johannes G\FCntert, Nicola Asuni

since 2.1.002

(2008-02-12)

Put pdf layers.

_putocg()
inherited
protected
since 3.0.000

(2008-03-27)

Output pages (and replace page number aliases).

_putpages()
inherited
protected

Output Resources Dictionary.

_putresourcedict()
inherited
protected

Output Resources.

_putresources()
inherited
protected

Output gradient shaders.

_putshaders()
inherited
author

Nicola Asuni

since 3.1.000

(2008-06-09)

protected

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

_putsignature()
inherited
protected
author

Nicola Asuni

since 4.6.008

(2009-05-07)

Output Spot Colors Resources.

_putspotcolors()
inherited
protected
since 4.0.024

(2008-09-12)

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

_puttruetypeunicode(array $font)
inherited
protected
author

Nicola Asuni

since 1.52.0.TC005

(2005-01-05)

Arguments

$font

array

font data

Output viewer preferences.

_putviewerpreferences(): string
inherited
author

Nicola asuni

since 3.1.000

(2008-06-09)

protected

Response

string

for viewer preferences

Put XMP data object and return ID.

_putXMP(): integer
inherited
since 5.9.121

(2011-09-28)

protected

Response

integer

The object ID.

Output Form XObjects Templates.

_putxobjects()
inherited
author

Nicola Asuni

since 5.8.017

(2010-08-24)

protected
see \startTemplate(),

endTemplate(), printTemplate()

Format a text string for meta information

_textstring(string $s,integer $n): string
inherited
protected

Arguments

$s

string

string to escape.

$n

integer

object ID

Response

string

escaped string.

Compute UE value (used for encryption)

_UEvalue(): string
inherited
protected
since 5.9.006

(2010-10-19)

author

Nicola Asuni

Response

string

UE value

Compute U value (used for encryption)

_Uvalue(): string
inherited
protected
since 2.0.000

(2008-01-02)

author

Nicola Asuni

Response

string

U value

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

AcceptPageBreak(): boolean
inherited

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.

public
since 1.4
see \SetAutoPageBreak()

Response

boolean

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

addEmptySignatureAppearance(float $x,float $y,float $w,float $h,integer $page = -1,string $name = '')
inherited
public
author

Nicola Asuni

since 5.9.101

(2011-07-06)

Arguments

$x

float

Abscissa of the upper-left corner.

$y

float

Ordinate of the upper-left corner.

$w

float

Width of the signature area.

$h

float

Height of the signature area.

$page

integer

option page number (if < 0 the current page is used).

$name

string

Name of the signature.

Add transparency parameters to the current extgstate

addExtGState(array $parms): integer|void
inherited
protected
since 3.0.000

(2008-03-27)

Arguments

$parms

array

parameters

Response

integer|void

the number of extgstates

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

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

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.

public
since 1.5
see \SetFont(),

setFontSubsetting()

Arguments

$family

string

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

$style

string

Font style. Possible values are (case insensitive):

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

$fontfile

string

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

$subset

mixed

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

Response

array|false

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

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

addHTMLTOC(integer|null $page = null,string $toc_name = 'TOC',array $templates = array(),boolean $correct_align = true,string $style = '',array $color = array(0, 0, 0))
inherited

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.

public
author

Nicola Asuni

since 5.0.001

(2010-05-06)

see \addTOCPage(),

endTOCPage(), addTOC()

Arguments

$page

integer|null

page number where this TOC should be inserted (leave empty for current page).

$toc_name

string

name to use for TOC bookmark.

$templates

array

array of html templates. Use: "#TOC_DESCRIPTION#" for bookmark title, "#TOC_PAGE_NUMBER#" for page number.

$correct_align

boolean

if true correct the number alignment (numbers must be in monospaced font like courier and right aligned on LTR, or left aligned on RTL)

$style

string

Font style for title: B = Bold, I = Italic, BI = Bold + Italic.

$color

array

RGB color array for title (values from 0 to 255).

Add vertical spaces if needed.

addHTMLVertSpace(string $hbz,string $hb,boolean $cell = false,boolean $firsttag = false,boolean $lasttag = false)
inherited
protected

Arguments

$hbz

string

Distance between current y and line bottom.

$hb

string

The height of the break.

$cell

boolean

if true add the default left (or right if RTL) padding to each new line (default false).

$firsttag

boolean

set to true when the tag is the first.

$lasttag

boolean

set to true when the tag is the last.

Adds a javascript object and return object ID

addJavascriptObject(string $script,boolean $onload = false): integer
inherited
public
author

Nicola Asuni

since 4.8.000

(2009-09-07)

Arguments

$script

string

Javascript code

$onload

boolean

if true executes this object when opening the document

Response

integer

internal object ID

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

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

The origin of the coordinate system is at the top-left corner (or top-right for RTL) and increasing ordinates go downwards.

public
since 1.0
see \startPage(),

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

Arguments

$orientation

string

page orientation. Possible values are (case insensitive):

  • P or PORTRAIT (default)
  • L or LANDSCAPE

$format

mixed

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

$keepmargins

boolean

if true overwrites the default page margins with the current margins

$tocpage

boolean

if true set the tocpage state to true (the added page will be used to display Table Of Content).

Add a single no-write region on selected page.

addPageRegion(array $region)
inherited

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.

author

Nicola Asuni

public
since 5.9.003

(2010-10-13)

see \setPageRegions(),

getPageRegions()

Arguments

$region

array

array of a single no-write region array: ('page' => page number or empy for current page, 'xt' => X top, 'yt' => Y top, 'xb' => X bottom, 'yb' => Y bottom, 'side' => page side 'L' = left or 'R' = right).

Defines a new spot color.

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

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.

public
since 4.0.024

(2008-09-12)

see \SetDrawSpotColor(),

SetFillSpotColor(), SetTextSpotColor()

Arguments

$name

string

Full name of the spot color.

$c

float

Cyan color for CMYK. Value between 0 and 100.

$m

float

Magenta color for CMYK. Value between 0 and 100.

$y

float

Yellow color for CMYK. Value between 0 and 100.

$k

float

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

Output a Table of Content Index (TOC).

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

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.

public
author

Nicola Asuni

since 4.5.000

(2009-01-02)

see \addTOCPage(),

endTOCPage(), addHTMLTOC()

Arguments

$page

integer|null

page number where this TOC should be inserted (leave empty for current page).

$numbersfont

string

set the font for page numbers (please use monospaced font for better alignment).

$filler

string

string used to fill the space between text and page number.

$toc_name

string

name to use for TOC bookmark.

$style

string

Font style for title: B = Bold, I = Italic, BI = Bold + Italic.

$color

array

RGB color array for bookmark title (values from 0 to 255).

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

addTOCPage(string $orientation = '',mixed $format = '',boolean $keepmargins = false)
inherited
public
since 5.0.001

(2010-05-06)

see \AddPage(),

startPage(), endPage(), endTOCPage()

Arguments

$orientation

string

page orientation.

$format

mixed

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

$keepmargins

boolean

if true overwrites the default page margins with the current margins

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

adjustCellPadding(string|array|integer|boolean $brd): void|array
inherited
public
since 5.9.000

(2010-10-03)

Arguments

$brd

string|array|integer|boolean

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

Response

void|array

array of adjustments

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

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

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

public
since 4.0.018

(2008-08-06)

Arguments

$x

float

Abscissa of the upper-left corner of the rectangle

$y

float

Ordinate of the upper-left corner of the rectangle

$w

float

Width of the rectangle

$h

float

Height of the rectangle

$text

string

annotation text or alternate content

$opt

array

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

$spaces

integer

number of spaces on the text to link

NOT YET IMPLEMENTED Request TSA for a timestamp

applyTSA(string $signature): string
inherited
protected
author

Richard Stockinger

since 6.0.090

(2014-06-16)

Arguments

$signature

string

Digital signature as binary string

Response

string

Timestamped digital signature

Draws a grahic arrow.

Arrow(float $x0,float $y0,float $x1,float $y1,integer $head_style,float $arm_size = 5,integer $arm_angle = 15)
inherited
author

Piotr Galecki, Nicola Asuni, Andy Meier

since 4.6.018

(2009-07-10)

Arguments

$x0

float

Abscissa of first point.

$y0

float

Ordinate of first point.

$x1

float

Abscissa of second point.

$y1

float

Ordinate of second point.

$head_style

integer

(0 = draw only arrowhead arms, 1 = draw closed arrowhead, but no fill, 2 = closed and filled arrowhead, 3 = filled arrowhead)

$arm_size

float

length of arrowhead arms

$arm_angle

integer

angle between an arm and the shaft

Adds a bookmark.

Bookmark(string $txt,integer $level,float $y = -1,integer|string $page = '',string $style = '',array $color = array(0, 0, 0),float $x = -1,mixed $link = '')
inherited
public
since 2.1.002

(2008-02-12)

Arguments

$txt

string

Bookmark description.

$level

integer

Bookmark level (minimum value is 0).

$y

float

Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;).

$page

integer|string

Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.

$style

string

Font style: B = Bold, I = Italic, BI = Bold + Italic.

$color

array

RGB color array (values from 0 to 255).

$x

float

X position in user units of the bookmark on the selected page (default = -1 = current position;).

$link

mixed

URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name).

Creates a button field

Button(string $name,integer $w,integer $h,string $caption,mixed $action,array $prop = array(),array $opt = array(),float|null $x = null,float|null $y = null,boolean $js = false)
inherited
public
author

Nicola Asuni

since 4.8.000

(2009-09-07)

Arguments

$name

string

field name

$w

integer

width

$h

integer

height

$caption

string

caption.

$action

mixed

action triggered by pressing the button. Use a string to specify a javascript action. Use an array to specify a form action options as on section 12.7.5 of PDF32000_2008.

$prop

array

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

$opt

array

annotation parameters. Possible values are described on official PDF32000_2008 reference.

$x

float|null

Abscissa of the upper-left corner of the rectangle

$y

float|null

Ordinate of the upper-left corner of the rectangle

$js

boolean

if true put the field using JavaScript (requires Acrobat Writer to be rendered).

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

Cell(float $w,float $h,string $txt = '',mixed $border,integer $ln,string $align = '',boolean $fill = false,mixed $link = '',integer $stretch,boolean $ignore_min_height = false,string $calign = 'T',string $valign = 'M')
inherited
public
since 1.0
see \SetFont(),

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

Arguments

$w

float

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

$h

float

Cell height. Default value: 0.

$txt

string

String to print. Default value: empty string.

$border

mixed

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

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

$ln

integer

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

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

$align

string

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

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

$fill

boolean

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

$link

mixed

URL or identifier returned by AddLink().

$stretch

integer

font stretch mode:

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

$ignore_min_height

boolean

if true ignore automatic minimum height value.

$calign

string

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

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

$valign

string

text vertical alignment inside the cell. Possible values are:

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

Creates a CheckBox field

CheckBox(string $name,integer $w,boolean $checked = false,array $prop = array(),array $opt = array(),string $onvalue = 'Yes',float|null $x = null,float|null $y = null,boolean $js = false)
inherited
public
author

Nicola Asuni

since 4.8.000

(2009-09-07)

Arguments

$name

string

field name

$w

integer

width

$checked

boolean

define the initial state.

$prop

array

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

$opt

array

annotation parameters. Possible values are described on official PDF32000_2008 reference.

$onvalue

string

value to be returned if selected.

$x

float|null

Abscissa of the upper-left corner of the rectangle

$y

float|null

Ordinate of the upper-left corner of the rectangle

$js

boolean

if true put the field using JavaScript (requires Acrobat Writer to be rendered).

Add page if needed.

checkPageBreak(float $h,float|null $y = null,boolean $addpage = true): boolean
inherited
since 3.2.000

(2008-07-01)

protected

Arguments

$h

float

Cell height. Default value: 0.

$y

float|null

starting y position, leave empty for current position.

$addpage

boolean

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

Response

boolean

true in case of page break, false otherwise.

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

checkPageRegions(float $h,float $x,float $y): array<mixed,float>
inherited

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.

author

Nicola Asuni

protected
since 5.9.003

(2010-10-13)

Arguments

$h

float

height of the text/image/object to print in user units

$x

float

current X coordinate in user units

$y

float

current Y coordinate in user units

Response

array<mixed,float>

array($x, $y)

Draws a circle.

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

A circle is formed from n Bezier curves.

public
since 2.1.000

(2008-01-08)

Arguments

$x0

float

Abscissa of center point.

$y0

float

Ordinate of center point.

$r

float

Radius.

$angstr

float

Angle start of draw line. Default value: 0.

$angend

float

Angle finish of draw line. Default value: 360.

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$line_style

array

Line style of circle. Array like for SetLineStyle(). Default value: default line style (empty array).

$fill_color

array

Fill color. Format: array(red, green, blue). Default value: default color (empty array).

$nc

integer

Number of curves used to draw a 90 degrees portion of circle.

Set a rectangular clipping area.

Clip(float $x,float $y,float $w,float $h)
inherited
author

Andreas W\FCrmser, Nicola Asuni

since 3.1.000

(2008-06-09)

protected

Arguments

$x

float

abscissa of the top left corner of the rectangle (or top right corner for RTL mode).

$y

float

ordinate of the top left corner of the rectangle.

$w

float

width of the rectangle.

$h

float

height of the rectangle.

Terminates the PDF document.

Close()
inherited

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.

public
since 1.0
see \Open(),

Output()

Process closing tags.

closeHTMLTagHandler(array $dom,integer $key,boolean $cell,integer $maxbottomliney): array
inherited
protected

Arguments

$dom

array

html dom array

$key

integer

current element id

$cell

boolean

if true add the default left (or right if RTL) padding to each new line (default false).

$maxbottomliney

integer

maximum y value of current line

Response

array

$dom

Paints color transition registration bars

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

Nicola Asuni

since 4.9.000

(2010-03-26)

public

Arguments

$x

float

abscissa of the top left corner of the rectangle.

$y

float

ordinate of the top left corner of the rectangle.

$w

float

width of the rectangle.

$h

float

height of the rectangle.

$transition

boolean

if true prints tcolor transitions to white.

$vertical

boolean

if true prints bar vertically.

$colors

string

colors to print separated by comma. Valid values are: A,W,R,G,B,C,M,Y,K,RGB,CMYK,ALL,ALLSPOT,. 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.

Creates a Combo-box field

ComboBox(string $name,integer $w,integer $h,array $values,array $prop = array(),array $opt = array(),float|null $x = null,float|null $y = null,boolean $js = false)
inherited
public
author

Nicola Asuni

since 4.8.000

(2009-09-07)

Arguments

$name

string

field name

$w

integer

width

$h

integer

height

$values

array

array containing the list of values.

$prop

array

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

$opt

array

annotation parameters. Possible values are described on official PDF32000_2008 reference.

$x

float|null

Abscissa of the upper-left corner of the rectangle

$y

float|null

Ordinate of the upper-left corner of the rectangle

$js

boolean

if true put the field using JavaScript (requires Acrobat Writer to be rendered).

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

commitTransaction()
inherited
public
since 4.5.029

(2009-03-19)

Convert SVG transformation matrix to PDF.

convertSVGtMatrix(array $tm): array
inherited
protected
since 5.0.000

(2010-05-02)

Arguments

$tm

array

original SVG transformation matrix

Response

array

transformation matrix

Paints a coons patch mesh.

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,array $coords_max = 1,boolean $antialias = false)
inherited
author

Andreas W\FCrmser, Nicola Asuni

since 3.1.000

(2008-06-09)

public

Arguments

$x

float

abscissa of the top left corner of the rectangle.

$y

float

ordinate of the top left corner of the rectangle.

$w

float

width of the rectangle.

$h

float

height of the rectangle.

$col1

array

first color (lower left corner) (RGB components).

$col2

array

second color (lower right corner) (RGB components).

$col3

array

third color (upper right corner) (RGB components).

$col4

array

fourth color (upper left corner) (RGB components).

$coords

array

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

$coords_min

array

minimum value used by the coordinates. If a coordinate's value is smaller than this it will be cut to coords_min. default: 0

$coords_max

array

maximum value used by the coordinates. If a coordinate's value is greater than this it will be cut to coords_max. default: 1

$antialias

boolean

A flag indicating whether to filter the shading function to prevent aliasing artifacts.

Clone the specified page to a new page.

copyPage(integer $page): boolean
inherited
public
since 4.9.015

(2010-04-20)

Arguments

$page

integer

number of page to copy (0 = current page)

Response

boolean

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

Paints crop marks.

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

Nicola Asuni

since 4.9.000

(2010-03-26)

public

Arguments

$x

float

abscissa of the crop mark center.

$y

float

ordinate of the crop mark center.

$w

float

width of the crop mark.

$h

float

height of the crop mark.

$type

string

type of crop mark, one symbol per type separated by comma: T = TOP, F = BOTTOM, L = LEFT, R = RIGHT, TL = A = TOP-LEFT, TR = B = TOP-RIGHT, BL = C = BOTTOM-LEFT, BR = D = BOTTOM-RIGHT.

$color

array

crop mark color (default spot registration color).

Draws a Bezier curve.

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

The Bezier curve is a tangent to the line between the control points at either end of the curve.

public
see \SetLineStyle()
since 2.1.000

(2008-01-08)

Arguments

$x0

float

Abscissa of start point.

$y0

float

Ordinate of start point.

$x1

float

Abscissa of control point 1.

$y1

float

Ordinate of control point 1.

$x2

float

Abscissa of control point 2.

$y2

float

Ordinate of control point 2.

$x3

float

Abscissa of end point.

$y3

float

Ordinate of end point.

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$line_style

array

Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array).

$fill_color

array

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

Remove the specified page.

deletePage(integer $page): boolean
inherited
public
since 4.6.004

(2009-04-23)

Arguments

$page

integer

page to remove

Response

boolean

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

Draw an HTML block border and fill

drawHTMLTagBorder(array $tag,integer $xmax)
inherited
protected
since 5.7.000

(2010-08-03)

Arguments

$tag

array

array of tag properties.

$xmax

integer

end X coordinate for border.

Draws an ellipse.

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

An ellipse is formed from n Bezier curves.

author

Nicola Asuni

public
since 2.1.000

(2008-01-08)

Arguments

$x0

float

Abscissa of center point.

$y0

float

Ordinate of center point.

$rx

float

Horizontal radius.

$ry

float

Vertical radius (if ry = 0 then is a circle, see Circle()). Default value: 0.

$angle

float

Angle oriented (anti-clockwise). Default value: 0.

$astart

float

Angle start of draw line. Default value: 0.

$afinish

float

Angle finish of draw line. Default value: 360.

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$line_style

array

Line style of ellipse. Array like for SetLineStyle(). Default value: default line style (empty array).

$fill_color

array

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

$nc

integer

Number of curves used to draw a 90 degrees portion of ellipse.

End the current PDF layer.

endLayer()
inherited
public
since 5.9.102

(2011-07-13)

Terminate the current page

endPage(boolean $tocpage = false)
inherited
public
since 4.2.010

(2008-11-14)

see \AddPage(),

startPage(), addTOCPage(), endTOCPage()

Arguments

$tocpage

boolean

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

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

endSVGElementHandler(resource|string $parser,string $name)
inherited
author

Nicola Asuni

since 5.0.000

(2010-05-02)

protected

Arguments

$parser

resource|string

The first parameter, parser, is a reference to the XML parser calling the handler.

$name

string

The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.

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

endTemplate(): string|false
inherited

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.

author

Nicola Asuni

public
since 5.8.017

(2010-08-24)

see \startTemplate(),

printTemplate()

Response

string|false

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

Terminate the current TOC (Table Of Content) page

endTOCPage()
inherited
public
since 5.0.001

(2010-05-06)

see \AddPage(),

startPage(), endPage(), addTOCPage()

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

Error(string $msg)
inherited
public
since 1.0

Arguments

$msg

string

The error message

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

fileExists(string $file): boolean
inherited

Arguments

$file

string

Response

boolean

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

fitBlock(float $w,float $h,float $x,float $y,boolean $fitonpage = false): array
inherited
protected
since 5.5.009

(2010-07-05)

Arguments

$w

float

width

$h

float

height

$x

float

X coordinate

$y

float

Y coodiante

$fitonpage

boolean

if true the block is resized to not exceed page dimensions.

Response

array

array($w, $h, $x, $y)

Cleanup HTML code (requires HTML Tidy library).

fixHTMLCode(string $html,string $default_css = '',array|null $tagvs = null,array|null $tidy_options = null): string
inherited
author

Nicola Asuni

public
since 5.9.017

(2010-11-16)

see \TCPDF::setHtmlVSpace()

Arguments

$html

string

htmlcode to fix

$default_css

string

CSS commands to add

$tagvs

array|null

parameters for setHtmlVSpace method

$tidy_options

array|null

options for tidy_parse_string function

Response

string

XHTML code cleaned up

Convert a relative font measure into absolute value.

getAbsFontMeasure(integer $s): float
inherited
since 5.9.186

(2012-09-13)

Arguments

$s

integer

Font measure.

Response

float

Absolute measure.

Returns the absolute X value of current position.

GetAbsX(): float
inherited
public
since 1.2
see \SetX(),

GetY(), SetY()

Response

float

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

getAliasNbPages(): string
inherited

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.

since 4.0.018

(2008-08-08)

public

Response

string

Returns the string alias used for the page number.

getAliasNumPage(): string
inherited

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.

since 4.5.000

(2009-01-02)

public

Response

string

Returns the string alias used right align page numbers.

getAliasRightShift(): string
inherited

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

since 5.9.099

(2011-06-27)

public

Response

string

Return an array containing all internal page aliases.

getAllInternalPageNumberAliases(): array
inherited
protected

Response

array

of page number aliases

Returns the array of spot colors.

getAllSpotColors(): array
inherited
public
since 6.0.038

(2013-09-30)

Response

array

Spot colors array.

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

getAlpha(): \array<string,bool|\string>
inherited

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

public
since 5.9.152

(2012-03-23)

Response

\array

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

GetArrStringWidth(array $sa,string $fontname = '',string $fontstyle = '',float $fontsize,boolean $getarray = false): array<mixed,float>|float
inherited
author

Nicola Asuni

public
since 2.4.000

(2008-03-06)

Arguments

$sa

array

The array of chars whose total length is to be computed

$fontname

string

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

$fontstyle

string

Font style. Possible values are (case insensitive):

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

$fontsize

float

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

$getarray

boolean

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

Response

array<mixed,float>|float

total string length or array of characted widths

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

getAutoPageBreak(): boolean
inherited
public
since 5.9.088

Response

boolean

auto-page-break mode

Get current barcode.

getBarcode(): string
inherited
public
since 4.0.012

(2008-07-24)

Response

string

Return the starting coordinates to draw an html border

getBorderStartPosition(): array
inherited
protected
since 5.7.000

(2010-08-03)

Response

array

containing top-left border coordinates

Returns the page break margin.

getBreakMargin(integer|null $pagenum = null): integer|float
inherited
author

Nicola Asuni

public
since 1.5.2
see \TCPDF::getPageDimensions()

Arguments

$pagenum

integer|null

page number (empty = current page)

Response

integer|float

page break margin.

Get buffer content.

getBuffer(): string
inherited
protected
since 4.5.000

(2009-01-02)

Response

string

buffer content

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

getCachedFileContents(string $file): string
inherited

Arguments

$file

string

Response

string

Returns the code to draw the cell border

getCellBorder(float $x,float $y,float $w,float $h,string|array|integer $brd): string
inherited
protected
see \SetLineStyle()
since 5.7.000

(2010-08-02)

Arguments

$x

float

X coordinate.

$y

float

Y coordinate.

$w

float

Cell width.

$h

float

Cell height.

$brd

string|array|integer

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

Response

string

containing cell border code

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

getCellCode(float $w,float $h,string $txt = '',mixed $border,integer $ln,string $align = '',boolean $fill = false,mixed $link = '',integer $stretch,boolean $ignore_min_height = false,string $calign = 'T',string $valign = 'M'): string
inherited
protected
since 1.0
see \TCPDF::Cell()

Arguments

$w

float

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

$h

float

Cell height. Default value: 0.

$txt

string

String to print. Default value: empty string.

$border

mixed

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

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

$ln

integer

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

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

$align

string

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

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

$fill

boolean

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

$link

mixed

URL or identifier returned by AddLink().

$stretch

integer

font stretch mode:

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

$ignore_min_height

boolean

if true ignore automatic minimum height value.

$calign

string

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

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

$valign

string

text vertical alignment inside the cell. Possible values are:

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

Response

string

containing cell code

Return the cell height

getCellHeight(integer $fontsize,boolean $padding = TRUE): float
inherited
public

Arguments

$fontsize

integer

Font size in internal units

$padding

boolean

If true add cell padding

Response

float

return the height of cell repect font height.

getCellHeightRatio(): float
inherited
public
since 4.0.012

(2008-07-24)

Response

float

Get the internal Cell margin array.

getCellMargins(): array
inherited
public
since 5.9.000

(2010-10-03)

see \TCPDF::setCellMargins()

Response

array

of margin values

Get the internal Cell padding array.

getCellPaddings(): array
inherited
public
since 5.9.000

(2010-10-03)

see \setCellPaddings(),

SetCellPadding()

Response

array

of padding values

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

getCharBBox(integer $char): false|array
inherited
since 5.9.186

(2012-09-13)

Arguments

$char

integer

Input character code.

Response

false|array

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

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

GetCharWidth(integer $char,boolean $notlast = true): float
inherited
author

Nicola Asuni

public
since 2.4.000

(2008-03-06)

Arguments

$char

integer

The char code whose length is to be returned

$notlast

boolean

If false ignore the font-spacing.

Response

float

char width

Return the current column number

getColumn(): integer
inherited
public
since 5.5.011

(2010-07-08)

Response

integer

current column number

Returns the border dash style from CSS property

getCSSBorderDashStyle(string $style): integer
inherited
protected
since 5.7.000

(2010-08-02)

Arguments

$style

string

border style to convert

Response

integer

sash style (return -1 in case of none or hidden border)

Get the border-spacing from CSS attribute.

getCSSBorderMargin(string $cssbspace,float $width): array
inherited
public
since 5.9.010

(2010-10-27)

Arguments

$cssbspace

string

border-spacing CSS properties

$width

float

width of the containing element

Response

array

of border spacings

Returns the border style array from CSS border properties

getCSSBorderStyle(string $cssborder): array
inherited
protected
since 5.7.000

(2010-08-02)

Arguments

$cssborder

string

border properties

Response

array

containing border properties

Returns the border width from CSS property

getCSSBorderWidth(string $width): integer
inherited
protected
since 5.7.000

(2010-08-02)

Arguments

$width

string

border width

Response

integer

with in user units

Returns the letter-spacing value from CSS value

getCSSFontSpacing(string $spacing,float $parent): float
inherited
protected
since 5.9.000

(2010-10-02)

Arguments

$spacing

string

letter-spacing value

$parent

float

font spacing (tracking) value of the parent element

Response

float

quantity to increases or decreases the space between characters in a text.

Returns the percentage of font stretching from CSS value

getCSSFontStretching(string $stretch,float $parent = 100): float
inherited
protected
since 5.9.000

(2010-10-02)

Arguments

$stretch

string

stretch mode

$parent

float

stretch value of the parent element

Response

float

font stretching percentage

Get the internal Cell margin from CSS attribute.

getCSSMargin(string $cssmargin,float $width): array
inherited
public
since 5.9.000

(2010-10-04)

Arguments

$cssmargin

string

margin properties

$width

float

width of the containing element

Response

array

of cell margins

Get the internal Cell padding from CSS attribute.

getCSSPadding(string $csspadding,float $width): array
inherited
public
since 5.9.000

(2010-10-04)

Arguments

$csspadding

string

padding properties

$width

float

width of the containing element

Response

array

of cell paddings

Return the Named Destination array.

getDestination(): array
inherited
public
author

Nicola Asuni

since 5.9.097

(2011-06-23)

Response

array

Named Destination array.

Returns document creation timestamp in seconds.

getDocCreationTimestamp(): integer
inherited
public
since 5.9.152

(2012-03-23)

Response

integer

Creation timestamp in seconds.

Returns document modification timestamp in seconds.

getDocModificationTimestamp(): integer
inherited
public
since 5.9.152

(2012-03-23)

Response

integer

Modfication timestamp in seconds.

Return the font ascent value.

getFontAscent(string $font,string $style = '',float $size): integer
inherited
public
author

Nicola Asuni

since 4.9.003

(2010-03-30)

Arguments

$font

string

font name

$style

string

font style

$size

float

The size (in points)

Response

integer

font ascent

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

getFontBBox(): array
inherited
public
since 5.9.152

(2012-03-23)

Response

array

Get font buffer content.

getFontBuffer(string $font): string|false
inherited
protected
since 4.5.000

(2009-01-02)

Arguments

$font

string

font key

Response

string|false

font buffer content or false in case of error

Return the font descent value

getFontDescent(string $font,string $style = '',float $size): integer
inherited
public
author

Nicola Asuni

since 4.9.003

(2010-03-30)

Arguments

$font

string

font name

$style

string

font style

$size

float

The size (in points)

Response

integer

font descent

Returns the current font family name.

getFontFamily(): string
inherited
public
since 4.3.008

(2008-12-05)

Response

string

current font family name

Return normalized font name

getFontFamilyName(string $fontfamily): string
inherited
author

Nicola Asuni

public
since 5.8.004

(2010-08-17)

Arguments

$fontfamily

string

property string containing font family names

Response

string

normalized font name

Returns the current font size.

getFontSize(): float
inherited
public
since 3.2.000

(2008-06-23)

Response

float

current font size

Returns the current font size in points unit.

getFontSizePt(): integer
inherited
public
since 3.2.000

(2008-06-23)

Response

integer

current font size in points unit

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

getFontsList()
inherited
protected
since 4.0.013

(2008-07-28)

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

getFontSpacing(): integer
inherited
author

Nicola Asuni

public
since 5.9.000

(2010-09-29)

Response

integer

font spacing (tracking) value

Get the percentage of character stretching.

getFontStretching(): float
inherited
author

Nicola Asuni

public
since 5.9.000

(2010-09-29)

Response

float

stretching value

Returns the current font style.

getFontStyle(): string
inherited
public
since 4.3.008

(2008-12-05)

Response

string

current font style

Return the default option for font subsetting.

getFontSubsetting(): boolean
inherited
author

Nicola Asuni

public
since 5.3.002

(2010-06-07)

Response

boolean

default font subsetting state.

Get Footer font.

getFooterFont(): \array<int,string|float|\null>
inherited
phpstan-return

array{0: string, 1: string, 2: float|null} $font

public
since 4.0.012

(2008-07-24)

Response

\array

Array describing the basic font parameters: (family, style, size).

Returns footer margin in user units.

getFooterMargin(): float
inherited
since 4.0.012

(2008-07-24)

public

Response

float

Return the default properties for form fields.

getFormDefaultProp(): array
inherited
public
author

Nicola Asuni

since 4.8.000

(2009-09-06)

Response

array

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

Get the GD-corrected PNG gamma value from alpha color

getGDgamma(resource $img,integer $c)
inherited
protected
since 4.3.007

(2008-12-04)

Arguments

$img

resource

GD image Resource ID.

$c

integer

alpha color

Returns current graphic variables as array.

getGraphicVars(): array
inherited
protected
since 4.2.010

(2008-11-14)

Response

array

of graphic variables

Return the current page in the group.

getGroupPageNo(): integer
inherited
public
since 3.0.000

(2008-03-27)

Response

integer

current page in the group

Returns the current group page number formatted as a string.

getGroupPageNoFormatted()
inherited
public
since 4.3.003

(2008-11-18)

see \PaneNo(),

formatPageNumber()

Return an hash code used to ensure that the serialized data has been generated by this TCPDF instance.

getHashForTCPDFtagParams(string $data): string
inherited
public

static

Arguments

$data

string

serialized data

Response

string

Returns header data: <ul><li>$ret['logo'] = logo image</li><li>$ret['logo_width'] = width of the image logo in user units</li><li>$ret['title'] = header title</li><li>$ret['string'] = header description string</li></ul>

getHeaderData(): \array<string,mixed>
inherited
public
since 4.0.012

(2008-07-24)

Response

\array

Get header font.

getHeaderFont(): \array<int,string|float|\null>
inherited
phpstan-return

array{0: string, 1: string, 2: float|null}

public
since 4.0.012

(2008-07-24)

Response

\array

Array describing the basic font parameters: (family, style, size).

Returns header margin in user units.

getHeaderMargin(): float
inherited
since 4.0.012

(2008-07-24)

public

Response

float

Returns the HTML DOM array.

getHtmlDomArray(string $html): array
inherited
protected
since 3.2.000

(2008-06-20)

Arguments

$html

string

html code

Response

array

Convert HTML string containing font size value to points

getHTMLFontUnits(string $val,float $refsize = 12,float $parent_size = 12,string $defaultunit = 'pt'): float
inherited
public

Arguments

$val

string

String containing font size value and unit.

$refsize

float

Reference font size in points.

$parent_size

float

Parent font size in points.

$defaultunit

string

Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt).

Response

float

value in points

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

getHTMLUnitToUnits(string $htmlval,string $refsize = 1,string $defaultunit = 'px',boolean $points = false): float
inherited
public
since 4.4.004

(2008-12-10)

Arguments

$htmlval

string

String containing values and unit.

$refsize

string

Reference value in points.

$defaultunit

string

Default unit (can be one of the following: %, em, ex, px, in, mm, pc, pt).

$points

boolean

If true returns points, otherwise returns value in user's units.

Response

float

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

Get image buffer content.

getImageBuffer(string $image): string|false
inherited
protected
since 4.5.000

(2008-12-31)

Arguments

$image

string

image key

Response

string|false

image buffer content or false in case of error

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

getImageRBX(): float
inherited
public

Response

float

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

getImageRBY(): float
inherited
public

Response

float

Returns the adjusting factor to convert pixels to user units.

getImageScale(): float
inherited
author

Nicola Asuni

public
since 1.5.2

Response

float

adjusting factor to convert pixels to user units.

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

getInternalPageNumberAliases(string $a = ''): array
inherited
protected

Arguments

$a

string

Base alias.

Response

array

of page number aliases

Get the last cell height.

getLastH(): float
inherited
public
since 4.0.017

(2008-08-05)

Response

float

last cell height

Returns the current the line width.

GetLineWidth(): integer
inherited
public
since 2.1.000

(2008-01-07)

see \Line(),

SetLineWidth()

Response

integer

Line width

Returns an array containing current margins: <ul> <li>$ret['left'] = left margin</li> <li>$ret['right'] = right margin</li> <li>$ret['top'] = top margin</li> <li>$ret['bottom'] = bottom margin</li> <li>$ret['header'] = header margin</li> <li>$ret['footer'] = footer margin</li> <li>$ret['cell'] = cell padding array</li> <li>$ret['padding_left'] = cell left padding</li> <li>$ret['padding_top'] = cell top padding</li> <li>$ret['padding_right'] = cell right padding</li> <li>$ret['padding_bottom'] = cell bottom padding</li> </ul>

getMargins(): array
inherited
public
since 3.2.000

(2008-06-23)

Response

array

containing all margins measures

Return the current number of columns.

getNumberOfColumns(): integer
inherited
public
since 5.8.018

(2010-08-25)

Response

integer

number of columns

Returns the numbero of characters in a string.

GetNumChars(string $s): integer
inherited
public
since 2.0.0001

(2008-01-07)

Arguments

$s

string

The input string.

Response

integer

number of characters

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

getNumLines(string $txt,float $w,boolean $reseth = false,boolean $autopadding = true,array|null $cellpadding = null,mixed $border): float
inherited
author

Alexander Escalona Fern\E1ndez, Nicola Asuni

public
since 4.5.011

Arguments

$txt

string

String for calculating his height

$w

float

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

$reseth

boolean

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

$autopadding

boolean

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

$cellpadding

array|null

Internal cell padding, if empty uses default cell padding.

$border

mixed

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

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

Response

float

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

Get the total number of insered pages.

getNumPages(): integer
inherited
public
since 2.1.000

(2008-01-07)

see \setPage(),

getPage(), lastpage()

Response

integer

number of pages

Returns an array containing original margins: <ul> <li>$ret['left'] = left margin</li> <li>$ret['right'] = right margin</li> </ul>

getOriginalMargins(): array
inherited
public
since 4.0.012

(2008-07-24)

Response

array

containing all margins measures

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

getOverprint(): \array<string,bool|\int>
inherited

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

public
since 5.9.152

(2012-03-23)

Response

\array

Get current document page number.

getPage(): integer
inherited
public
since 2.1.000

(2008-01-07)

see \setPage(),

lastpage(), getNumPages()

Response

integer

page number

Get page buffer content.

getPageBuffer(integer $page): string
inherited
protected
since 4.5.000

(2008-12-31)

Arguments

$page

integer

page number

Response

string

page buffer content or false in case of error

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

getPageDimensions(integer|null $pagenum = null): array
inherited
author

Nicola Asuni

public
since 4.5.027

(2009-03-16)

Arguments

$pagenum

integer|null

page number (empty = current page)

Response

array

of page dimensions.

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

getPageGroupAlias(): string
inherited

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.

public
since 3.0.000

(2008-03-27)

Response

string

alias of the current page group

Returns the page height in units.

getPageHeight(integer|null $pagenum = null): integer|float
inherited
author

Nicola Asuni

public
since 1.5.2
see \TCPDF::getPageDimensions()

Arguments

$pagenum

integer|null

page number (empty = current page)

Response

integer|float

page height.

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

getPageNumGroupAlias(): string
inherited

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

public
since 4.5.000

(2009-01-02)

Response

string

alias of the current page group

Return an array of no-write page regions

getPageRegions(): array
inherited
author

Nicola Asuni

public
since 5.9.003

(2010-10-13)

see \setPageRegions(),

addPageRegion()

Response

array

of no-write page regions

Returns the page width in units.

getPageWidth(integer|null $pagenum = null): integer|float
inherited
author

Nicola Asuni

public
since 1.5.2
see \TCPDF::getPageDimensions()

Arguments

$pagenum

integer|null

page number (empty = current page)

Response

integer|float

page width.

Returns the PDF data.

getPDFData()
inherited
public

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

getRawCharWidth(integer $char): float
inherited
author

Nicola Asuni

public
since 5.9.000

(2010-09-28)

Arguments

$char

integer

The char code whose length is to be returned

Response

float

char width

Returns the remaining width between the current position and margins.

getRemainingWidth(): float
inherited
protected

Response

float

Return the remaining width

Return the RTL status

getRTL(): boolean
inherited
public
since 4.0.012

(2008-07-24)

Response

boolean

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

getScaleFactor(): integer
inherited
author

Nicola Asuni

public
since 1.5.2

Response

integer

scale factor.

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

getSignatureAppearanceArray(float $x,float $y,float $w,float $h,integer $page = -1,string $name = ''): array
inherited
protected
author

Nicola Asuni

since 5.9.101

(2011-07-06)

Arguments

$x

float

Abscissa of the upper-left corner.

$y

float

Ordinate of the upper-left corner.

$w

float

Width of the signature area.

$h

float

Height of the signature area.

$page

integer

option page number (if < 0 the current page is used).

$name

string

Name of the signature.

Response

array

Array defining page and rectangle coordinates of signature appearance.

Returns the string used to find spaces

getSpaceString(): string
inherited
protected
author

Nicola Asuni

since 4.8.024

(2010-01-15)

Response

string

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

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

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

pre

// store current object $pdf->startTransaction(); // store starting values $start_y = $pdf->GetY(); $start_page = $pdf->getPage(); // call your printing functions with your parameters // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $pdf->MultiCell($w=0, $h=0, $txt, $border=1, $align='L', $fill=false, $ln=1, $x=null, $y=null, $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // get the new Y $end_y = $pdf->GetY(); $end_page = $pdf->getPage(); // calculate height $height = 0; if ($end_page == $start_page) { $height = $end_y - $start_y; } else { for ($page=$start_page; $page <= $end_page; ++$page) { $this->setPage($page); if ($page == $start_page) { // first page $height += $this->h - $start_y - $this->bMargin; } elseif ($page == $end_page) { // last page $height += $end_y - $this->tMargin; } else { $height += $this->h - $this->tMargin - $this->bMargin; } } } // restore previous object $pdf = $pdf->rollbackTransaction();

author

Nicola Asuni, Alexander Escalona Fern\E1ndez

public

Arguments

$w

float

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

$txt

string

String for calculating his height

$reseth

boolean

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

$autopadding

boolean

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

$cellpadding

array|null

Internal cell padding, if empty uses default cell padding.

$border

mixed

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

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

Response

float

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

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

GetStringWidth(string $s,string $fontname = '',string $fontstyle = '',float $fontsize,boolean $getarray = false): array<mixed,float>|float
inherited
author

Nicola Asuni

public
since 1.2

Arguments

$s

string

The string whose length is to be computed

$fontname

string

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

$fontstyle

string

Font style. Possible values are (case insensitive):

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

$fontsize

float

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

$getarray

boolean

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

Response

array<mixed,float>|float

total string length or array of characted widths

Return the text shadow parameters array.

getTextShadow(): array
inherited
since 5.9.174

(2012-07-25)

public

Response

array

array of parameters.

Returns the relative X value of current position.

GetX(): float
inherited

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

public
since 1.2
see \SetX(),

GetY(), SetY()

Response

float

Returns the ordinate of the current position.

GetY(): float
inherited
public
since 1.0
see \SetY(),

GetX(), SetX()

Response

float

Output gradient.

Gradient(integer $type,array $coords,array $stops,array $background = array(),boolean $antialias = false)
inherited
author

Nicola Asuni

since 3.1.000

(2008-06-09)

public

Arguments

$type

integer

type of gradient (1 Function-based shading; 2 Axial shading; 3 Radial shading; 4 Free-form Gouraud-shaded triangle mesh; 5 Lattice-form Gouraud-shaded triangle mesh; 6 Coons patch mesh; 7 Tensor-product patch mesh). (Not all types are currently supported)

$coords

array

array of coordinates.

$stops

array

array gradient color components: color = array of GRAY, RGB or CMYK color components; offset = (0 to 1) represents a location along the gradient vector; exponent = exponent of the exponential interpolation function (default = 1).

$background

array

An array of colour components appropriate to the colour space, specifying a single background colour value.

$antialias

boolean

A flag indicating whether to filter the shading function to prevent aliasing artifacts.

This method is used to render the page header.

Header()
inherited

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

public

Returns text with soft hyphens.

hyphenateText(string $text,mixed $patterns,array $dictionary = array(),integer $leftmin = 1,integer $rightmin = 2,integer $charmin = 1,integer $charmax = 8): string
inherited
author

Nicola Asuni

since 4.9.012

(2010-04-12)

public

Arguments

$text

string

text to process

$patterns

mixed

Array of hypenation patterns or a TEX file containing hypenation patterns. TEX patterns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/

$dictionary

array

Array of words to be returned without applying the hyphenation algorithm.

$leftmin

integer

Minimum number of character to leave on the left of the word without applying the hyphens.

$rightmin

integer

Minimum number of character to leave on the right of the word without applying the hyphens.

$charmin

integer

Minimum word length to apply the hyphenation algorithm.

$charmax

integer

Maximum length of broken piece of word.

Response

string

text with soft hyphens

Returns an array of chars containing soft hyphens.

hyphenateWord(array $word,array $patterns,array $dictionary = array(),integer $leftmin = 1,integer $rightmin = 2,integer $charmin = 1,integer $charmax = 8): array
inherited
author

Nicola Asuni

since 4.9.012

(2010-04-12)

protected

Arguments

$word

array

array of chars

$patterns

array

Array of hypenation patterns.

$dictionary

array

Array of words to be returned without applying the hyphenation algorithm.

$leftmin

integer

Minimum number of character to leave on the left of the word without applying the hyphens.

$rightmin

integer

Minimum number of character to leave on the right of the word without applying the hyphens.

$charmin

integer

Minimum word length to apply the hyphenation algorithm.

$charmax

integer

Maximum length of broken piece of word.

Response

array

text with soft hyphens

Puts an image in the page.

Image(string $file,float|null $x = null,float|null $y = null,float $w,float $h,string $type = '',mixed $link = '',string $align = '',mixed $resize = false,integer $dpi = 300,string $palign = '',boolean $ismask = false,mixed $imgmask = false,mixed $border,mixed $fitbox = false,boolean $hidden = false,boolean $fitonpage = false,boolean $alt = false,array $altimgs = array()): mixed|false
inherited

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.
public
since 1.1

Arguments

$file

string

Name of the file containing the image or a '@' character followed by the image data string. To link an image without embedding it on the document, set an asterisk character before the URL (i.e.: '*http://www.example.com/image.jpg').

$x

float|null

Abscissa of the upper-left corner (LTR) or upper-right corner (RTL).

$y

float|null

Ordinate of the upper-left corner (LTR) or upper-right corner (RTL).

$w

float

Width of the image in the page. If not specified or equal to zero, it is automatically calculated.

$h

float

Height of the image in the page. If not specified or equal to zero, it is automatically calculated.

$type

string

Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension.

$link

mixed

URL or identifier returned by AddLink().

$align

string

Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

$resize

mixed

If true resize (reduce) the image to fit $w and $h (requires GD or ImageMagick library); if false do not resize; if 2 force resize in all cases (upscaling and downscaling).

$dpi

integer

dot-per-inch resolution used on resize

$palign

string

Allows to center or align the image on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

$ismask

boolean

true if this image is a mask, false otherwise

$imgmask

mixed

image object returned by this function or false

$border

mixed

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

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

$fitbox

mixed

If not false scale image dimensions proportionally to fit within the ($w, $h) box. $fitbox can be true or a 2 characters string indicating the image alignment inside the box. The first character indicate the horizontal alignment (L = left, C = center, R = right) the second character indicate the vertical algnment (T = top, M = middle, B = bottom).

$hidden

boolean

If true do not display the image.

$fitonpage

boolean

If true the image is resized to not exceed page dimensions.

$alt

boolean

If true the image will be added as alternative and not directly printed (the ID of the image will be returned).

$altimgs

array

Array of alternate images IDs. Each alternative image must be an array with two values: an integer representing the image ID (the value returned by the Image method) and a boolean value to indicate if the image is the default for printing.

Response

mixed|false

image information

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

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

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

author

Valentin Schmidt, Nicola Asuni

since 3.1.000

(2008-06-09)

public

Arguments

$file

string

Name of the file containing the image or a '@' character followed by the EPS/AI data string.

$x

float|null

Abscissa of the upper-left corner.

$y

float|null

Ordinate of the upper-left corner.

$w

float

Width of the image in the page. If not specified or equal to zero, it is automatically calculated.

$h

float

Height of the image in the page. If not specified or equal to zero, it is automatically calculated.

$link

mixed

URL or identifier returned by AddLink().

$useBoundingBox

boolean

specifies whether to position the bounding box (true) or the complete canvas (false) at location (x,y). Default value is true.

$align

string

Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

$palign

string

Allows to center or align the image on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

$border

mixed

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

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

$fitonpage

boolean

if true the image is resized to not exceed page dimensions.

$fixoutvals

boolean

if true remove values outside the bounding box.

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

ImagePngAlpha(string $file,float $x,float $y,float $wpx,float $hpx,float $w,float $h,string $type,mixed $link,string $align,boolean $resize,integer $dpi,string $palign,string $filehash = '')
inherited
author

Nicola Asuni

protected
since 4.3.007

(2008-12-04)

see \TCPDF::Image()

Arguments

$file

string

Name of the file containing the image.

$x

float

Abscissa of the upper-left corner.

$y

float

Ordinate of the upper-left corner.

$wpx

float

Original width of the image in pixels.

$hpx

float

original height of the image in pixels.

$w

float

Width of the image in the page. If not specified or equal to zero, it is automatically calculated.

$h

float

Height of the image in the page. If not specified or equal to zero, it is automatically calculated.

$type

string

Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension.

$link

mixed

URL or identifier returned by AddLink().

$align

string

Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

$resize

boolean

If true resize (reduce) the image to fit $w and $h (requires GD library).

$dpi

integer

dot-per-inch resolution used on resize

$palign

string

Allows to center or align the image on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

$filehash

string

File hash used to build unique file names.

Embedd a Scalable Vector Graphics (SVG) image.

ImageSVG(string $file,float|null $x = null,float|null $y = null,float $w,float $h,mixed $link = '',string $align = '',string $palign = '',mixed $border,boolean $fitonpage = false)
inherited

NOTE: SVG standard is not yet fully implemented, use the setRasterizeVectorImages() method to enable/disable rasterization of vector images using ImageMagick library.

author

Nicola Asuni

since 5.0.000

(2010-05-02)

public

Arguments

$file

string

Name of the SVG file or a '@' character followed by the SVG data string.

$x

float|null

Abscissa of the upper-left corner.

$y

float|null

Ordinate of the upper-left corner.

$w

float

Width of the image in the page. If not specified or equal to zero, it is automatically calculated.

$h

float

Height of the image in the page. If not specified or equal to zero, it is automatically calculated.

$link

mixed

URL or identifier returned by AddLink().

$align

string

Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line
If the alignment is an empty string, then the pointer will be restored on the starting SVG position.

$palign

string

Allows to center or align the image on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

$border

mixed

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

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

$fitonpage

boolean

if true the image is resized to not exceed page dimensions.

Adds a javascript

IncludeJS(string $script)
inherited
public
author

Johannes G\FCntert, Nicola Asuni

since 2.1.002

(2008-02-12)

Arguments

$script

string

Javascript code

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

inPageBody(): boolean
inherited
protected
since 5.9.091

(2011-06-15)

Response

boolean

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

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

isCharDefined(mixed $char,string $font = '',string $style = ''): boolean
inherited
public
since 5.9.153

(2012-03-28)

Arguments

$char

mixed

Character to check (integer value or string)

$font

string

Font name (family name).

$style

string

Font style.

Response

boolean

true if the char is defined, false otherwise.

Return the current temporary RTL status

isRTLTextDir(): boolean
inherited
public
since 4.8.014

(2009-11-04)

Response

boolean

Return true if the current font is unicode type.

isUnicodeFont(): boolean
inherited
author

Nicola Asuni

public
since 5.8.002

(2010-08-14)

Response

boolean

true for unicode font, false otherwise.

Reset pointer to the last document page.

lastPage(boolean $resetmargins = false)
inherited
public
since 2.0.000

(2008-01-04)

see \setPage(),

getPage(), getNumPages()

Arguments

$resetmargins

boolean

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

Draws a line between two points.

Line(float $x1,float $y1,float $x2,float $y2,array $style = array())
inherited
public
since 1.0
see \SetLineWidth(),

SetDrawColor(), SetLineStyle()

Arguments

$x1

float

Abscissa of first point.

$y1

float

Ordinate of first point.

$x2

float

Abscissa of second point.

$y2

float

Ordinate of second point.

$style

array

Line style. Array like for SetLineStyle(). Default value: default line style (empty array).

Paints a linear colour gradient.

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

Andreas W\FCrmser, Nicola Asuni

since 3.1.000

(2008-06-09)

public

Arguments

$x

float

abscissa of the top left corner of the rectangle.

$y

float

ordinate of the top left corner of the rectangle.

$w

float

width of the rectangle.

$h

float

height of the rectangle.

$col1

array

first color (Grayscale, RGB or CMYK components).

$col2

array

second color (Grayscale, RGB or CMYK components).

$coords

array

array of the form (x1, y1, x2, y2) which defines the gradient vector (see linear_gradient_coords.jpg). The default value is from left to right (x1=0, y1=0, x2=1, y2=0).

Creates a List-box field

ListBox(string $name,integer $w,integer $h,array $values,array $prop = array(),array $opt = array(),float|null $x = null,float|null $y = null,boolean $js = false)
inherited
public
author

Nicola Asuni

since 4.8.000

(2009-09-07)

Arguments

$name

string

field name

$w

integer

width

$h

integer

height

$values

array

array containing the list of values.

$prop

array

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

$opt

array

annotation parameters. Possible values are described on official PDF32000_2008 reference.

$x

float|null

Abscissa of the upper-left corner of the rectangle

$y

float|null

Ordinate of the upper-left corner of the rectangle

$js

boolean

if true put the field using JavaScript (requires Acrobat Writer to be rendered).

Performs a line break.

Ln(float|null $h = null,boolean $cell = false)
inherited

The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter.

public
since 1.0
see \TCPDF::Cell()

Arguments

$h

float|null

The height of the break. By default, the value equals the height of the last printed cell.

$cell

boolean

if true add the current left (or right o for RTL) padding to the X coordinate

Horizontal Mirroring.

MirrorH(float|null $x = null)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$x

float|null

abscissa of the point. Default is current x position

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

MirrorL(float $angle,float|null $x = null,float|null $y = null)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$angle

float

gradient angle of the straight line. Default is 0 (horizontal line).

$x

float|null

abscissa of the point. Default is current x position

$y

float|null

ordinate of the point. Default is current y position

Point reflection mirroring.

MirrorP(float|null $x = null,float|null $y = null)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$x

float|null

abscissa of the point. Default is current x position

$y

float|null

ordinate of the point. Default is current y position

Verical Mirroring.

MirrorV(float|null $y = null)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$y

float|null

ordinate of the point. Default is current y position

Move a page to a previous position.

movePage(integer $frompage,integer $topage): boolean
inherited
public
since 4.5.000

(2009-01-02)

Arguments

$frompage

integer

number of the source page

$topage

integer

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

Response

boolean

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

This method allows printing text with line breaks.

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

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.

public
since 1.3
see \SetFont(),

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

Arguments

$w

float

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

$h

float

Cell minimum height. The cell extends automatically if needed.

$txt

string

String to print

$border

mixed

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

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

$align

string

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

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

$fill

boolean

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

$ln

integer

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

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

$x

float|null

x position in user units

$y

float|null

y position in user units

$reseth

boolean

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

$stretch

integer

font stretch mode:

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

$ishtml

boolean

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

$autopadding

boolean

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

$maxh

float

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

$valign

string

Vertical alignment of text (requires $maxh = $h > 0). Possible values are:

  • T: TOP
  • M: middle
  • B: bottom
. This feature works only when $ishtml=false and the cell must fit in a single page.

$fitcell

boolean

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

Response

integer

Return the number of cells or 1 for html mode.

This method begins the generation of the PDF document.

Open()
inherited

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

public
since 1.0
see \AddPage(),

Close()

Process opening tags.

openHTMLTagHandler(array $dom,integer $key,boolean $cell): array
inherited
protected

Arguments

$dom

array

html dom array

$key

integer

current element id

$cell

boolean

if true add the default left (or right if RTL) padding to each new line (default false).

Response

array

$dom

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

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

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.

public
since 1.0
see \TCPDF::Close()

Arguments

$name

string

The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.

$dest

string

Destination where to send the document. It can take one of the following values:

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

Response

string

Returns the current page number.

PageNo(): integer
inherited
public
since 1.0
see \TCPDF::getAliasNbPages()

Response

integer

page number

Returns the current page number formatted as a string.

PageNoFormatted()
inherited
public
since 4.2.005

(2008-11-06)

see \PaneNo(),

formatPageNumber()

Draw the sector of a circle.

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

It can be used for instance to render pie charts.

author

Maxime Delorme, Nicola Asuni

since 3.1.000

(2008-06-09)

public

Arguments

$xc

float

abscissa of the center.

$yc

float

ordinate of the center.

$r

float

radius.

$a

float

start angle (in degrees).

$b

float

end angle (in degrees).

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$cw

float

indicates whether to go clockwise (default: true).

$o

float

origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock). Default: 90.

Draw the sector of an ellipse.

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

It can be used for instance to render pie charts.

author

Maxime Delorme, Nicola Asuni

since 3.1.000

(2008-06-09)

public

Arguments

$xc

float

abscissa of the center.

$yc

float

ordinate of the center.

$rx

float

the x-axis radius.

$ry

float

the y-axis radius.

$a

float

start angle (in degrees).

$b

float

end angle (in degrees).

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$cw

float

indicates whether to go clockwise.

$o

float

origin of angles (0 for 3 o'clock, 90 for noon, 180 for 9 o'clock, 270 for 6 o'clock).

$nc

integer

Number of curves used to draw a 90 degrees portion of arc.

Converts pixels to User's Units.

pixelsToUnits(integer $px): float
inherited
public
see \setImageScale(),

getImageScale()

Arguments

$px

integer

pixels

Response

float

value in user's unit

Draws a poly-Bezier curve.

Polycurve(float $x0,float $y0,array<mixed,float> $segments,string $style = '',array $line_style = array(),array $fill_color = array())
inherited

Each Bezier curve segment is a tangent to the line between the control points at either end of the curve.

public
see \SetLineStyle()
since 3.0008

(2008-05-12)

Arguments

$x0

float

Abscissa of start point.

$y0

float

Ordinate of start point.

$segments

array<mixed,float>

An array of bezier descriptions. Format: array(x1, y1, x2, y2, x3, y3).

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$line_style

array

Line style of curve. Array like for SetLineStyle(). Default value: default line style (empty array).

$fill_color

array

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

Draws a polygon.

Polygon(array $p,string $style = '',array $line_style = array(),array $fill_color = array(),boolean $closed = true)
inherited
public
since 2.1.000

(2008-01-08)

Arguments

$p

array

Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1))

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$line_style

array

Line style of polygon. Array with keys among the following:

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

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

$fill_color

array

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

$closed

boolean

if true the polygon is closes, otherwise will remain open

Draws a polygonal line

PolyLine(array $p,string $style = '',array $line_style = array(),array $fill_color = array())
inherited
since 4.8.003

(2009-09-15)

public

Arguments

$p

array

Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1))

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$line_style

array

Line style of polygon. Array with keys among the following:

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

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

$fill_color

array

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

Print an XObject Template.

printTemplate(string $id,float|null $x = null,float|null $y = null,float $w,float $h,string $align = '',string $palign = '',boolean $fitonpage = false)
inherited

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.

author

Nicola Asuni

public
since 5.8.017

(2010-08-24)

see \startTemplate(),

endTemplate()

Arguments

$id

string

The ID of XObject Template to print.

$x

float|null

X position in user units (empty string = current x position)

$y

float|null

Y position in user units (empty string = current y position)

$w

float

Width in user units (zero = remaining page width)

$h

float

Height in user units (zero = remaining page height)

$align

string

Indicates the alignment of the pointer next to template insertion relative to template height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

$palign

string

Allows to center or align the template on the current line. Possible values are:

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

$fitonpage

boolean

If true the template is resized to not exceed page dimensions.

Output an HTML list bullet or ordered item symbol

putHtmlListBullet(integer $listdepth,string $listtype = '',float $size = 10)
inherited
protected
since 4.4.004

(2008-12-10)

Arguments

$listdepth

integer

list nesting level

$listtype

string

type of list

$size

float

current font size

Paints a radial colour gradient.

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))
inherited
author

Andreas W\FCrmser, Nicola Asuni

since 3.1.000

(2008-06-09)

public

Arguments

$x

float

abscissa of the top left corner of the rectangle.

$y

float

ordinate of the top left corner of the rectangle.

$w

float

width of the rectangle.

$h

float

height of the rectangle.

$col1

array

first color (Grayscale, RGB or CMYK components).

$col2

array

second color (Grayscale, RGB or CMYK components).

$coords

array

array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with color1, (cx, cy) is the center of the circle with color2, and r is the radius of the circle (see radial_gradient_coords.jpg). (fx, fy) should be inside the circle, otherwise some areas will not be defined.

Creates a RadioButton field.

RadioButton(string $name,integer $w,array $prop = array(),array $opt = array(),string $onvalue = 'On',boolean $checked = false,float|null $x = null,float|null $y = null,boolean $js = false)
inherited
public
author

Nicola Asuni

since 4.8.000

(2009-09-07)

Arguments

$name

string

Field name.

$w

integer

Width of the radio button.

$prop

array

Javascript field properties. Possible values are described on official Javascript for Acrobat API reference.

$opt

array

Annotation parameters. Possible values are described on official PDF32000_2008 reference.

$onvalue

string

Value to be returned if selected.

$checked

boolean

Define the initial state.

$x

float|null

Abscissa of the upper-left corner of the rectangle

$y

float|null

Ordinate of the upper-left corner of the rectangle

$js

boolean

If true put the field using JavaScript (requires Acrobat Writer to be rendered).

Draws a rectangle.

Rect(float $x,float $y,float $w,float $h,string $style = '',array $border_style = array(),array $fill_color = array())
inherited
public
since 1.0
see \SetLineStyle()

Arguments

$x

float

Abscissa of upper-left corner.

$y

float

Ordinate of upper-left corner.

$w

float

Width.

$h

float

Height.

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$border_style

array

Border style of rectangle. Array with keys among the following:

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

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

$fill_color

array

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

Paints a registration mark

registrationMark(float $x,float $y,float $r,boolean $double = false,array $cola = array(100, 100, 100, 100, 'All'),array $colb = array(0, 0, 0, 0, 'None'))
inherited
author

Nicola Asuni

since 4.9.000

(2010-03-26)

public

Arguments

$x

float

abscissa of the registration mark center.

$y

float

ordinate of the registration mark center.

$r

float

radius of the crop mark.

$double

boolean

if true print two concentric crop marks.

$cola

array

crop mark color (default spot registration color 'All').

$colb

array

second crop mark color (default spot registration color 'None').

Paints a CMYK registration mark

registrationMarkCMYK(float $x,float $y,float $r)
inherited
author

Nicola Asuni

since 6.0.038

(2013-09-30)

public

Arguments

$x

float

abscissa of the registration mark center.

$y

float

ordinate of the registration mark center.

$r

float

radius of the crop mark.

Draws a regular polygon.

RegularPolygon(float $x0,float $y0,float $r,integer $ns,float $angle,boolean $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())
inherited
public
since 2.1.000

(2008-01-08)

Arguments

$x0

float

Abscissa of center point.

$y0

float

Ordinate of center point.

$r

float

Radius of inscribed circle.

$ns

integer

Number of sides.

$angle

float

Angle oriented (anti-clockwise). Default value: 0.

$draw_circle

boolean

Draw inscribed circle or not. Default value: false.

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$line_style

array

Line style of polygon sides. Array with keys among the following:

  • all: Line style of all sides. Array like for SetLineStyle().
  • 0 to ($ns - 1): Line style of each side. Array like for SetLineStyle().

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

$fill_color

array

Fill color. Format: array(red, green, blue). Default value: default color (empty array).

$circle_style

string

Style of rendering of inscribed circle (if draws). Possible values are:

  • D or empty string: Draw (default).
  • F: Fill.
  • DF or FD: Draw and fill.
  • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
  • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).

$circle_outLine_style

array

Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array).

$circle_fill_color

array

Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array).

Remove a single no-write region.

removePageRegion(integer $key)
inherited
author

Nicola Asuni

public
since 5.9.003

(2010-10-13)

see \setPageRegions(),

getPageRegions()

Arguments

$key

integer

region key

Return the tag name without the namespace

removeTagNamespace(string $name)
inherited
protected

Arguments

$name

string

Tag name

Replace the buffer content

replaceBuffer(string $data)
inherited
protected
since 5.5.000

(2010-06-22)

Arguments

$data

string

data

Replace a char if is defined on the current font.

replaceChar(integer $oldchar,integer $newchar): integer
inherited
protected
since 5.9.167

(2012-06-22)

Arguments

$oldchar

integer

Integer code (unicode) of the character to replace.

$newchar

integer

Integer code (unicode) of the new character.

Response

integer

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

Replace missing font characters on selected font with specified substitutions.

replaceMissingChars(string $text,string $font = '',string $style = '',array $subs = array()): string
inherited
public
since 5.9.153

(2012-03-28)

Arguments

$text

string

Text to process.

$font

string

Font name (family name).

$style

string

Font style.

$subs

array

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

Response

string

Processed text.

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

replaceRightShiftPageNumAliases(string $page,array $aliases,integer $diff): string
inherited

This works perfectly only when using monospaced fonts.

protected

Arguments

$page

string

Page content.

$aliases

array

Array of page aliases.

$diff

integer

initial difference to add.

Response

string

replaced page content.

Remove columns and reset page margins.

resetColumns()
inherited
public
since 5.9.072

(2011-04-26)

Reset the xobject template used by Header() method.

resetHeaderTemplate()
inherited
public

Reset the last cell height.

resetLastH()
inherited
public
since 5.9.000

(2010-10-03)

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

rollbackTransaction(boolean $self = false): \TCPDF
inherited
public
since 4.5.029

(2009-03-19)

Arguments

$self

boolean

if true restores current class object to previous state without the need of reassignment via the returned value.

Response

\TCPDF

object.

Rotate object.

Rotate(float $angle,float|null $x = null,float|null $y = null)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$angle

float

angle in degrees for counter-clockwise rotation

$x

float|null

abscissa of the rotation center. Default is current x position

$y

float|null

ordinate of the rotation center. Default is current y position

Draws a rounded rectangle.

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())
inherited
public
since 2.1.000

(2008-01-08)

Arguments

$x

float

Abscissa of upper-left corner.

$y

float

Ordinate of upper-left corner.

$w

float

Width.

$h

float

Height.

$r

float

the radius of the circle used to round off the corners of the rectangle.

$round_corner

string

Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111").

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$border_style

array

Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array).

$fill_color

array

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

Draws a rounded rectangle.

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())
inherited
public
since 4.9.019

(2010-04-22)

Arguments

$x

float

Abscissa of upper-left corner.

$y

float

Ordinate of upper-left corner.

$w

float

Width.

$h

float

Height.

$rx

float

the x-axis radius of the ellipse used to round off the corners of the rectangle.

$ry

float

the y-axis radius of the ellipse used to round off the corners of the rectangle.

$round_corner

string

Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111").

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$border_style

array

Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array).

$fill_color

array

Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).

Vertical and horizontal non-proportional Scaling.

Scale(float $s_x,float $s_y,float|null $x = null,float|null $y = null)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$s_x

float

scaling factor for width as percent. 0 is not allowed.

$s_y

float

scaling factor for height as percent. 0 is not allowed.

$x

float|null

abscissa of the scaling center. Default is current x position

$y

float|null

ordinate of the scaling center. Default is current y position

Horizontal Scaling.

ScaleX(float $s_x,integer $x = '',integer $y = '')
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$s_x

float

scaling factor for width as percent. 0 is not allowed.

$x

integer

abscissa of the scaling center. Default is current x position

$y

integer

ordinate of the scaling center. Default is current y position

Vertical and horizontal proportional Scaling.

ScaleXY(float $s,integer $x = '',integer $y = '')
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$s

float

scaling factor for width and height as percent. 0 is not allowed.

$x

integer

abscissa of the scaling center. Default is current x position

$y

integer

ordinate of the scaling center. Default is current y position

Vertical Scaling.

ScaleY(float $s_y,integer $x = '',integer $y = '')
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$s_y

float

scaling factor for height as percent. 0 is not allowed.

$x

integer

abscissa of the scaling center. Default is current x position

$y

integer

ordinate of the scaling center. Default is current y position

Sets the character data handler function for the XML parser.

segSVGContentHandler(resource $parser,string $data)
inherited
author

Nicola Asuni

since 5.0.000

(2010-05-02)

protected

Arguments

$parser

resource

The first parameter, parser, is a reference to the XML parser calling the handler.

$data

string

The second parameter, data, contains the character data as a string.

Set position at a given column

selectColumn(integer|null $col = null)
inherited
public
since 4.9.001

(2010-03-28)

Arguments

$col

integer|null

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

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

serializeTCPDFtagParameters(array $data): string
inherited
public

static

Arguments

$data

array

parameters array

Response

string

containing serialized data

Set the absolute X coordinate of the current pointer.

setAbsX(float $x)
inherited
public
since 5.9.186

(2012-09-13)

see \setAbsX(),

setAbsY(), SetAbsXY()

Arguments

$x

float

The value of the abscissa in user units.

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

setAbsXY(float $x,float $y)
inherited
public
since 5.9.186

(2012-09-13)

see \setAbsX(),

setAbsY(), SetAbsXY()

Arguments

$x

float

The value of the abscissa in user units.

$y

float

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

Set the absolute Y coordinate of the current pointer.

setAbsY(float $y)
inherited
public
since 5.9.186

(2012-09-13)

see \setAbsX(),

setAbsY(), SetAbsXY()

Arguments

$y

float

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

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

setAllowLocalFiles(boolean $allowLocalFiles)
inherited
public
since 6.4

Arguments

$allowLocalFiles

boolean

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

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

setAlpha(float $stroking = 1,string $bm = 'Normal',float|null $nonstroking = null,boolean $ais = false)
inherited
public
since 3.0.000

(2008-03-27)

Arguments

$stroking

float

Alpha value for stroking operations: real value from 0 (transparent) to 1 (opaque).

$bm

string

blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity

$nonstroking

float|null

Alpha value for non-stroking operations: real value from 0 (transparent) to 1 (opaque).

$ais

boolean

Defines the author of the document.

setAuthor(string $author)
inherited
public
since 1.2
see \SetCreator(),

SetKeywords(), SetSubject(), SetTitle()

Arguments

$author

string

The name of the author.

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.

setAutoPageBreak(boolean $auto,float $margin)
inherited
public
since 1.0
see \Cell(),

MultiCell(), AcceptPageBreak()

Arguments

$auto

boolean

Boolean indicating if mode should be on or off.

$margin

float

Distance from the bottom of the page.

Set document barcode.

setBarcode(string $bc = '')
inherited
public

Arguments

$bc

string

barcode

Set the booklet mode for double-sided pages.

setBooklet(boolean $booklet = true,float $inner = -1,float $outer = -1)
inherited
public
since 4.2.000

(2008-10-29)

Arguments

$booklet

boolean

true set the booklet mode on, false otherwise.

$inner

float

Inner page margin.

$outer

float

Outer page margin.

Adds a bookmark - alias for Bookmark().

setBookmark(string $txt,integer $level,float $y = -1,integer|string $page = '',string $style = '',array $color = array(0, 0, 0),float $x = -1,mixed $link = '')
inherited
public

Arguments

$txt

string

Bookmark description.

$level

integer

Bookmark level (minimum value is 0).

$y

float

Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;).

$page

integer|string

Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.

$style

string

Font style: B = Bold, I = Italic, BI = Bold + Italic.

$color

array

RGB color array (values from 0 to 255).

$x

float

X position in user units of the bookmark on the selected page (default = -1 = current position;).

$link

mixed

URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name).

Set buffer content (always append data).

setBuffer(string $data)
inherited
protected
since 4.5.000

(2009-01-02)

Arguments

$data

string

data

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

setCellHeightRatio(float $h)
inherited
public
since 3.0.014

(2008-06-04)

Arguments

$h

float

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

Set the internal Cell margins.

setCellMargins(integer|float|null $left = null,integer|float|null $top = null,integer|float|null $right = null,integer|float|null $bottom = null)
inherited
public
since 5.9.000

(2010-10-03)

see \TCPDF::getCellMargins()

Arguments

$left

integer|float|null

left margin

$top

integer|float|null

top margin

$right

integer|float|null

right margin

$bottom

integer|float|null

bottom margin

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

setCellPadding(integer|float $pad)
inherited
public
since 2.1.000

(2008-01-09)

see \getCellPaddings(),

setCellPaddings()

Arguments

$pad

integer|float

internal padding.

Set the internal Cell paddings.

setCellPaddings(integer|float|null $left = null,integer|float|null $top = null,integer|float|null $right = null,integer|float|null $bottom = null)
inherited
public
since 5.9.000

(2010-10-03)

see \getCellPaddings(),

SetCellPadding()

Arguments

$left

integer|float|null

left padding

$top

integer|float|null

top padding

$right

integer|float|null

right padding

$bottom

integer|float|null

bottom padding

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

setColor(string $type,float $col1,float $col2 = -1,float $col3 = -1,float $col4 = -1,boolean $ret = false,string $name = ''): string
inherited
public
since 5.9.125

(2011-10-03)

Arguments

$type

string

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

$col1

float

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

$col2

float

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

$col3

float

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

$col4

float

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

$ret

boolean

If true do not send the command.

$name

string

spot color name (if any)

Response

string

The PDF command or empty string.

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

setColorArray(string $type,array $color,boolean $ret = false): string
inherited

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.

public
since 3.1.000

(2008-06-11)

Arguments

$type

string

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

$color

array

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

$ret

boolean

If true do not send the PDF command.

Response

string

The PDF command or empty string.

Set columns array.

setColumnsArray(array $columns)
inherited

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

public
since 4.9.001

(2010-03-28)

Arguments

$columns

array

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.

setCompression(boolean $compress = true)
inherited

Note: the Zlib extension is required for this feature. If not present, compression will be turned off.

public
since 1.4

Arguments

$compress

boolean

Boolean indicating if compression must be enabled.

Set start-writing mark on selected page.

setContentMark(integer $page)
inherited

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

protected
since 4.6.021

(2009-07-20)

Arguments

$page

integer

page number (default is the current page)

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

setCreator(string $creator)
inherited
public
since 1.2
see \SetAuthor(),

SetKeywords(), SetSubject(), SetTitle()

Arguments

$creator

string

The name of the creator.

Defines the default monospaced font.

setDefaultMonospacedFont(string $font)
inherited
public
since 4.5.025

Arguments

$font

string

Font name.

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

setDefaultTableColumns(integer $cols = 4)
inherited
public
since 3.0.014

(2008-06-04)

Arguments

$cols

integer

number of columns

Add a Named Destination.

setDestination(string $name,float $y = -1,integer|string $page = '',float $x = -1): string|false
inherited

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

public
author

Christian Deligant, Nicola Asuni

since 5.9.097

(2011-06-23)

Arguments

$name

string

Destination name.

$y

float

Y position in user units of the destiantion on the selected page (default = -1 = current position; 0 = page start;).

$page

integer|string

Target page number (leave empty for current page). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.

$x

float

X position in user units of the destiantion on the selected page (default = -1 = current position;).

Response

string|false

Stripped named destination identifier or false in case of error.

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

setDisplayMode(mixed $zoom,string $layout = 'SinglePage',string $mode = 'UseNone')
inherited
public
since 1.2

Arguments

$zoom

mixed

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

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

$layout

string

The page layout. Possible values are:

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

$mode

string

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

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

Set the document creation timestamp

setDocCreationTimestamp(mixed $time)
inherited
public
since 5.9.152

(2012-03-23)

Arguments

$time

mixed

Document creation timestamp in seconds or date-time string.

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

setDocInfoUnicode(boolean $unicode = true)
inherited

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

since 5.9.027

(2010-12-01)

public

Arguments

$unicode

boolean

if true set the meta information in Unicode

Set the document modification timestamp

setDocModificationTimestamp(mixed $time)
inherited
public
since 5.9.152

(2012-03-23)

Arguments

$time

mixed

Document modification timestamp in seconds or date-time string.

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

setDrawColor(float $col1,float $col2 = -1,float $col3 = -1,float $col4 = -1,boolean $ret = false,string $name = ''): string
inherited
public
since 1.3
see \SetDrawColorArray(),

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

Arguments

$col1

float

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

$col2

float

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

$col3

float

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

$col4

float

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

$ret

boolean

If true do not send the command.

$name

string

spot color name (if any)

Response

string

the PDF command

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

setDrawColorArray(array $color,boolean $ret = false): string
inherited

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.

public
since 3.1.000

(2008-06-11)

see \SetDrawColor()

Arguments

$color

array

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

$ret

boolean

If true do not send the PDF command.

Response

string

the PDF command

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

setDrawSpotColor(string $name,float $tint = 100)
inherited
public
since 4.0.024

(2008-09-12)

see \AddSpotColor(),

SetFillSpotColor(), SetTextSpotColor()

Arguments

$name

string

Name of the spot color.

$tint

float

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

Set multiple columns of the same size

setEqualColumns(integer $numcols,integer $width,integer|null $y = null)
inherited
public
since 4.9.001

(2010-03-28)

Arguments

$numcols

integer

number of columns (set to zero to disable columns mode)

$width

integer

column width

$y

integer|null

column starting Y position (leave empty for current Y position)

Add an extgstate

setExtGState(integer $gs)
inherited
protected
since 3.0.000

(2008-03-27)

Arguments

$gs

integer

extgstate

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

setExtraXMP(string $xmp)
inherited

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

since 5.9.128

(2011-10-06)

public

Arguments

$xmp

string

Custom XMP data.

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

setExtraXMPRDF(string $xmp)
inherited

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

since 6.3.0

(2019-09-19)

public

Arguments

$xmp

string

Custom XMP RDF data.

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.

setFillColor(float $col1,float $col2 = -1,float $col3 = -1,float $col4 = -1,boolean $ret = false,string $name = ''): string
inherited
public
since 1.3
see \SetFillColorArray(),

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

Arguments

$col1

float

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

$col2

float

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

$col3

float

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

$col4

float

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

$ret

boolean

If true do not send the command.

$name

string

Spot color name (if any).

Response

string

The PDF command.

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

setFillColorArray(array $color,boolean $ret = false)
inherited

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.

public
since 3.1.000

(2008-6-11)

see \SetFillColor()

Arguments

$color

array

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

$ret

boolean

If true do not send the PDF command.

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

setFillSpotColor(string $name,float $tint = 100)
inherited
public
since 4.0.024

(2008-09-12)

see \AddSpotColor(),

SetDrawSpotColor(), SetTextSpotColor()

Arguments

$name

string

Name of the spot color.

$tint

float

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

Sets the font used to print character strings.

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

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

author

Nicola Asuni

public
since 1.0
see \AddFont(),

SetFontSize()

Arguments

$family

string

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

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

$style

string

Font style. Possible values are (case insensitive):

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

$size

float|null

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

$fontfile

string

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

$subset

mixed

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

$out

boolean

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

Set font buffer content.

setFontBuffer(string $font,array $data)
inherited
protected
since 4.5.000

(2009-01-02)

Arguments

$font

string

font key

$data

array

font data

Defines the size of the current font.

setFontSize(float $size,boolean $out = true)
inherited
public
since 1.0
see \SetFont()

Arguments

$size

float

The font size in points.

$out

boolean

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

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

setFontSpacing(float $spacing)
inherited
author

Nicola Asuni

public
since 5.9.000

(2010-09-29)

Arguments

$spacing

float

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

Set the percentage of character stretching.

setFontStretching(integer $perc = 100)
inherited
author

Nicola Asuni

public
since 5.9.000

(2010-09-29)

Arguments

$perc

integer

percentage of stretching (100 = no stretching)

Set font buffer content.

setFontSubBuffer(string $font,string $key,mixed $data)
inherited
protected
since 4.5.000

(2009-01-02)

Arguments

$font

string

font key

$key

string

font sub-key

$data

mixed

font data

Enable or disable default option for font subsetting.

setFontSubsetting(boolean $enable = true)
inherited
author

Nicola Asuni

public
since 5.3.002

(2010-06-07)

Arguments

$enable

boolean

if true enable font subsetting by default.

This method is used to render the page footer.

setFooter()
inherited
protected
since 4.0.012

(2008-07-24)

Set footer data.

setFooterData(array<mixed,integer> $tc = array(0, 0, 0),array<mixed,integer> $lc = array(0, 0, 0))
inherited
public

Arguments

$tc

array<mixed,integer>

RGB array color for text.

$lc

array<mixed,integer>

RGB array color for line.

Set footer font.

setFooterFont(\array<int,string|float|\null> $font)
inherited
phpstan-param

array{0: string, 1: string, 2: float|null} $font

public
since 1.1

Arguments

$font

\array

Array describing the basic font parameters: (family, style, size).

Set footer margin.

setFooterMargin(integer $fm = 10)
inherited

(minimum distance between footer and bottom page margin)

public

Arguments

$fm

integer

distance in user units

Set default properties for form fields.

setFormDefaultProp(array $prop = array())
inherited
public
author

Nicola Asuni

since 4.8.000

(2009-09-06)

Arguments

$prop

array

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

Set graphic variables.

setGraphicVars(array $gvars,boolean $extended = false)
inherited
protected
since 4.2.010

(2008-11-14)

Arguments

$gvars

array

array of graphic variablesto restore

$extended

boolean

if true restore extended graphic variables

This method is used to render the page header.

setHeader()
inherited
protected
since 4.0.012

(2008-07-24)

Set header data.

setHeaderData(string $ln = '',integer $lw,string $ht = '',string $hs = '',array<mixed,integer> $tc = array(0, 0, 0),array<mixed,integer> $lc = array(0, 0, 0))
inherited
public

Arguments

$ln

string

header image logo

$lw

integer

header image logo width in mm

$ht

string

string to print as title on document header

$hs

string

string to print on document header

$tc

array<mixed,integer>

RGB array color for text.

$lc

array<mixed,integer>

RGB array color for line.

Set header font.

setHeaderFont(\array<int,string|float|\null> $font)
inherited
phpstan-param

array{0: string, 1: string, 2: float|null} $font

public
since 1.1

Arguments

$font

\array

Array describing the basic font parameters: (family, style, size).

Set header margin.

setHeaderMargin(integer $hm = 10)
inherited

(minimum distance between header and top page margin)

public

Arguments

$hm

integer

distance in user units

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

setHeaderTemplateAutoreset(boolean $val = true)
inherited
public

Arguments

$val

boolean

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

Set the color and font style for HTML links.

setHtmlLinksStyle(array $color = array(0, 0, 255),string $fontstyle = 'U')
inherited
public
since 4.4.003

(2008-12-09)

Arguments

$color

array

RGB array of colors

$fontstyle

string

additional font styles to add

Set the vertical spaces for HTML tags.

setHtmlVSpace(array $tagvs)
inherited

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.

public
since 4.2.001

(2008-10-30)

Arguments

$tagvs

array

array of tags and relative vertical spaces.

Set image buffer content.

setImageBuffer(string $image,array $data): integer
inherited
protected
since 4.5.000

(2008-12-31)

Arguments

$image

string

image key

$data

array

image data

Response

integer

image index number

Set the adjusting factor to convert pixels to user units.

setImageScale(float $scale)
inherited
author

Nicola Asuni

public
since 1.5.2

Arguments

$scale

float

adjusting factor to convert pixels to user units.

Set image buffer content for a specified sub-key.

setImageSubBuffer(string $image,string $key,array $data)
inherited
protected
since 4.5.000

(2008-12-31)

Arguments

$image

string

image key

$key

string

image sub-key

$data

array

image data

Set the default JPEG compression quality (1-100)

setJPEGQuality(integer $quality)
inherited
public
since 3.0.000

(2008-03-27)

Arguments

$quality

integer

JPEG quality, integer between 1 and 100

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

setKeywords(string $keywords)
inherited

..'.

public
since 1.2
see \SetAuthor(),

SetCreator(), SetSubject(), SetTitle()

Arguments

$keywords

string

The list of keywords.

Set language array.

setLanguageArray(array $language)
inherited
public
since 1.1

Arguments

$language

array

Set the last cell height.

setLastH(float $h)
inherited
author

Nicola Asuni

public
since 1.53.0.TC034

Arguments

$h

float

cell height.

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.

setLeftMargin(integer|float $margin)
inherited
public
since 1.4
see \SetTopMargin(),

SetRightMargin(), SetAutoPageBreak(), SetMargins()

Arguments

$margin

integer|float

The margin.

Set line style.

setLineStyle(array $style,boolean $ret = false): string
inherited
public
since 2.1.000

(2008-01-08)

Arguments

$style

array

Line style. Array with keys among the following:

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

$ret

boolean

if true do not send the command.

Response

string

the PDF command

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.

setLineWidth(float $width)
inherited
public
since 1.0
see \Line(),

Rect(), Cell(), MultiCell()

Arguments

$width

float

The width.

Set custom width for list indentation.

setListIndentWidth(float $width)
inherited
public
since 4.2.007

(2008-11-12)

Arguments

$width

float

width of the indentation. Use negative value to disable it.

Set the default bullet to be used as LI bullet symbol

setLIsymbol(string $symbol = '!')
inherited
public
since 4.0.028

(2008-09-26)

Arguments

$symbol

string

character or string to be used (legal values are: '' = automatic, '!' = auto bullet, '#' = auto numbering, 'disc', 'disc', 'circle', 'square', '1', 'decimal', 'decimal-leading-zero', 'i', 'lower-roman', 'I', 'upper-roman', 'a', 'lower-alpha', 'lower-latin', 'A', 'upper-alpha', 'upper-latin', 'lower-greek', 'img|type|width|height|image.ext')

Defines the left, top and right margins.

setMargins(integer|float $left,integer|float $top,integer|float|null $right = null,boolean $keepmargins = false)
inherited
public
since 1.0
see \SetLeftMargin(),

SetTopMargin(), SetRightMargin(), SetAutoPageBreak()

Arguments

$left

integer|float

Left margin.

$top

integer|float

Top margin.

$right

integer|float|null

Right margin. Default value is the left one.

$keepmargins

boolean

if true overwrites the default page margins

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

setOpenCell(boolean $isopen)
inherited
public
since 4.2.010

(2008-11-14)

Arguments

$isopen

boolean

if true keeps the top/bottom border open for the cell sides that cross the page.

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

setOverprint(boolean $stroking = true,boolean|null $nonstroking = null,integer $mode)
inherited

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

public
since 5.9.152

(2012-03-23)

Arguments

$stroking

boolean

If true apply overprint for stroking operations.

$nonstroking

boolean|null

If true apply overprint for painting operations other than stroking.

$mode

integer

Overprint mode: (0 = each source colour component value replaces the value previously painted for the corresponding device colorant; 1 = a tint value of 0.0 for a source colour component shall leave the corresponding component of the previously painted colour unchanged).

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

setPage(integer $pnum,boolean $resetmargins = false)
inherited
public
since 2.1.000

(2008-01-07)

see \getPage(),

lastpage(), getNumPages()

Arguments

$pnum

integer

page number (1 ... numpages)

$resetmargins

boolean

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

Set page boxes to be included on page descriptions.

setPageBoxTypes(array $boxes)
inherited
protected

Arguments

$boxes

array

Array of page boxes to set on document: ('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox').

Set page buffer content.

setPageBuffer(integer $page,string $data,boolean $append = false)
inherited
protected
since 4.5.000

(2008-12-31)

Arguments

$page

integer

page number

$data

string

page data

$append

boolean

if true append data, false replace.

Change the format of the current page

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

(2008-06-06)

see \getPageSizeFromFormat()

Arguments

$format

mixed

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

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

$orientation

string

page orientation. Possible values are (case insensitive):

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

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

setPageMark()
inherited

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.

public
since 4.0.016

(2008-07-30)

Set page orientation.

setPageOrientation(string $orientation,boolean|null $autopagebreak = null,float|null $bottommargin = null)
inherited
public
since 3.0.015

(2008-06-06)

Arguments

$orientation

string

page orientation. Possible values are (case insensitive):

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

$autopagebreak

boolean|null

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

$bottommargin

float|null

bottom margin of the page.

Set no-write regions on page.

setPageRegions(array $regions = array())
inherited

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.

author

Nicola Asuni

public
since 5.9.003

(2010-10-13)

see \addPageRegion(),

getPageRegions()

Arguments

$regions

array

array of no-write regions. For each region you can define an array as follow: ('page' => page number or empy for current page, 'xt' => X top, 'yt' => Y top, 'xb' => X bottom, 'yb' => Y bottom, 'side' => page side 'L' = left or 'R' = right). Omit this parameter to remove all regions.

Set the units of measure for the document.

setPageUnit(string $unit)
inherited
public
since 3.0.015

(2008-06-06)

Arguments

$unit

string

User measure unit. Possible values are:

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

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

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

setPDFVersion(string $version = '1.7')
inherited
public
since 3.1.000

(2008-06-09)

Arguments

$version

string

PDF document version.

Set a flag to print page footer.

setPrintFooter(boolean $val = true)
inherited
public

Arguments

$val

boolean

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

Set a flag to print page header.

setPrintHeader(boolean $val = true)
inherited
public

Arguments

$val

boolean

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

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

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

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.

public
since 2.0.000

(2008-01-02)

author

Nicola Asuni

Arguments

$permissions

array

the set of permissions (specify the ones you want to block):

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

$user_pass

string

user password. Empty by default.

$owner_pass

string|null

owner password. If not specified, a random value is used.

$mode

integer

encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit.

$pubkeys

array|null

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

Enable/disable rasterization of vector images using ImageMagick library.

setRasterizeVectorImages(boolean $mode)
inherited
public
since 5.0.000

(2010-04-27)

Arguments

$mode

boolean

if true enable rasterization, false otherwise.

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

setRightMargin(integer|float $margin)
inherited
public
since 1.5
see \SetLeftMargin(),

SetTopMargin(), SetAutoPageBreak(), SetMargins()

Arguments

$margin

integer|float

The margin.

Enable or disable Right-To-Left language mode

setRTL(boolean $enable,boolean $resetx = true)
inherited
public
since 2.0.000

(2008-01-03)

Arguments

$enable

boolean

if true enable Right-To-Left language mode.

$resetx

boolean

if true reset the X position on direction change.

Enable document signature (requires the OpenSSL Library).

setSignature(mixed $signing_cert = '',mixed $private_key = '',string $private_key_password = '',string $extracerts = '',integer $cert_type = 2,array $info = array(),string $approval = '')
inherited

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

public
author

Nicola Asuni

since 4.6.005

(2009-04-24)

Arguments

$signing_cert

mixed

signing certificate (string or filename prefixed with 'file://')

$private_key

mixed

private key (string or filename prefixed with 'file://')

$private_key_password

string

password

$extracerts

string

specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used.

$cert_type

integer

The access permissions granted for this document. Valid values shall be: 1 = No changes to the document shall be permitted; any change to the document shall invalidate the signature; 2 = Permitted changes shall be filling in forms, instantiating page templates, and signing; other changes shall invalidate the signature; 3 = Permitted changes shall be the same as for 2, as well as annotation creation, deletion, and modification; other changes shall invalidate the signature.

$info

array

array of option information: Name, Location, Reason, ContactInfo.

$approval

string

Enable approval signature eg. for PDF incremental update

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

setSignatureAppearance(float $x,float $y,float $w,float $h,integer $page = -1,string $name = '')
inherited
public
author

Nicola Asuni

since 5.3.011

(2010-06-17)

Arguments

$x

float

Abscissa of the upper-left corner.

$y

float

Ordinate of the upper-left corner.

$w

float

Width of the signature area.

$h

float

Height of the signature area.

$page

integer

option page number (if < 0 the current page is used).

$name

string

Name of the signature.

Set regular expression to detect withespaces or word separators.

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

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)
public
since 4.6.016

(2009-06-15)

Arguments

$re

string

regular expression (leave empty for default).

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

setSpotColor(string $type,string $name,float $tint = 100): string
inherited
public
since 5.9.125

(2011-10-03)

Arguments

$type

string

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

$name

string

Name of the spot color.

$tint

float

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

Response

string

PDF color command.

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

setSRGBmode(boolean $mode = false)
inherited
public
since 5.9.121

(2011-09-28)

Arguments

$mode

boolean

If true force sRGB output intent.

Set the starting page number.

setStartingPageNumber(integer $num = 1)
inherited
since 5.9.093

(2011-06-16)

public

Arguments

$num

integer

Starting page number.

Defines the subject of the document.

setSubject(string $subject)
inherited
public
since 1.2
see \SetAuthor(),

SetCreator(), SetKeywords(), SetTitle()

Arguments

$subject

string

The subject.

Apply the requested SVG styles (*** TO BE COMPLETED ***)

setSVGStyles(array $svgstyle,array $prevsvgstyle,integer $x,integer $y,integer $w = 1,integer $h = 1,string $clip_function = '',array $clip_params = array()): string
inherited
author

Nicola Asuni

since 5.0.000

(2010-05-02)

protected

Arguments

$svgstyle

array

array of SVG styles to apply

$prevsvgstyle

array

array of previous SVG style

$x

integer

X origin of the bounding box

$y

integer

Y origin of the bounding box

$w

integer

width of the bounding box

$h

integer

height of the bounding box

$clip_function

string

clip function

$clip_params

array

array of parameters for clipping function

Response

string

style

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

setTableHeader()
inherited
protected
since 4.5.030

(2009-03-25)

Force temporary RTL language direction

setTempRTL(false|string $mode)
inherited
public
since 2.1.000

(2008-01-09)

Arguments

$mode

false|string

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

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.

setTextColor(float $col1,float $col2 = -1,float $col3 = -1,float $col4 = -1,boolean $ret = false,string $name = ''): string
inherited
public
since 1.3
see \SetTextColorArray(),

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

Arguments

$col1

float

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

$col2

float

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

$col3

float

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

$col4

float

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

$ret

boolean

If true do not send the command.

$name

string

Spot color name (if any).

Response

string

Empty string.

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

setTextColorArray(array $color,boolean $ret = false)
inherited

The method can be called before the first page is created and the value is retained from page to page.

public
since 3.1.000

(2008-6-11)

see \SetFillColor()

Arguments

$color

array

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

$ret

boolean

If true do not send the PDF command.

Set Text rendering mode.

setTextRenderingMode(integer $stroke,boolean $fill = true,boolean $clip = false)
inherited
public
since 4.9.008

(2009-04-02)

Arguments

$stroke

integer

outline size in user units (0 = disable).

$fill

boolean

if true fills the text (default).

$clip

boolean

if true activate clipping mode

Set parameters for drop shadow effect for text.

setTextShadow(array $params = array('enabled' => false, 'depth_w' => 0, 'depth_h' => 0, 'color' => false, 'opacity' => 1, 'blend_mode' => 'Normal'))
inherited
since 5.9.174

(2012-07-25)

public

Arguments

$params

array

Array of parameters: enabled (boolean) set to true to enable shadow; depth_w (float) shadow width in user units; depth_h (float) shadow height in user units; color (array) shadow color or false to use the stroke color; opacity (float) Alpha value: real value from 0 (transparent) to 1 (opaque); blend_mode (string) blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity.

Defines the spot color used for text.

setTextSpotColor(string $name,integer $tint = 100)
inherited
public
since 4.0.024

(2008-09-12)

see \AddSpotColor(),

SetDrawSpotColor(), SetFillSpotColor()

Arguments

$name

string

Name of the spot color.

$tint

integer

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

Enable document timestamping (requires the OpenSSL Library).

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

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!

public
author

Richard Stockinger

since 6.0.090

(2014-06-16)

Arguments

$tsa_host

string

Time Stamping Authority (TSA) server (prefixed with 'https://')

$tsa_username

string

Specifies the username for TSA authorization (optional) OR specifies the TSA authorization PEM file (see: example_66.php, optional)

$tsa_password

string

Specifies the password for TSA authorization (optional)

$tsa_cert

string

Specifies the location of TSA certificate for authorization (optional for cURL)

Defines the title of the document.

setTitle(string $title)
inherited
public
since 1.2
see \SetAuthor(),

SetCreator(), SetKeywords(), SetSubject()

Arguments

$title

string

The title.

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

setTopMargin(integer|float $margin)
inherited
public
since 1.5
see \SetLeftMargin(),

SetRightMargin(), SetAutoPageBreak(), SetMargins()

Arguments

$margin

integer|float

The margin.

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

setUserRights(boolean $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 = '')
inherited

Check the PDF Reference 8.7.1 Transform Methods, Table 8.105 Entries in the UR transform parameters dictionary

public
author

Nicola Asuni

since 2.9.000

(2008-03-26)

Arguments

$enable

boolean

if true enable user's rights on PDF reader

$document

string

Names specifying additional document-wide usage rights for the document. The only defined value is "/FullSave", which permits a user to save the document along with modified form and/or annotation data.

$annots

string

Names specifying additional annotation-related usage rights for the document. Valid names in PDF 1.5 and later are /Create/Delete/Modify/Copy/Import/Export, which permit the user to perform the named operation on annotations.

$form

string

Names specifying additional form-field-related usage rights for the document. Valid names are: /Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate

$signature

string

Names specifying additional signature-related usage rights for the document. The only defined value is /Modify, which permits a user to apply a digital signature to an existing signature form field or clear a signed signature form field.

$ef

string

Names specifying additional usage rights for named embedded files in the document. Valid names are /Create/Delete/Modify/Import, which permit the user to perform the named operation on named embedded files Names specifying additional embedded-files-related usage rights for the document.

$formex

string

Names specifying additional form-field-related usage rights. The only valid name is BarcodePlaintext, which permits text form field data to be encoded as a plaintext two-dimensional barcode.

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

setViewerPreferences(array $preferences)
inherited

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

Nicola Asuni

public
since 3.1.000

(2008-06-09)

Arguments

$preferences

array

array of options.

Set the visibility of the successive elements.

setVisibility(string $v)
inherited

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

public
since 3.0.000

(2008-03-27)

Arguments

$v

string

visibility mode. Legal values are: all, print, screen or view.

Defines the abscissa of the current position.

setX(float $x,boolean $rtloff = false)
inherited

If the passed value is negative, it is relative to the right of the page (or left if language is RTL).

public
since 1.2
see \GetX(),

GetY(), SetY(), SetXY()

Arguments

$x

float

The value of the abscissa in user units.

$rtloff

boolean

if true always uses the page top-left corner as origin of axis.

Defines the abscissa and ordinate of the current position.

setXY(float $x,float $y,boolean $rtloff = false)
inherited

If the passed values are negative, they are relative respectively to the right and bottom of the page.

public
since 1.2
see \SetX(),

SetY()

Arguments

$x

float

The value of the abscissa.

$y

float

The value of the ordinate.

$rtloff

boolean

if true always uses the page top-left corner as origin of axis.

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

setY(float $y,boolean $resetx = true,boolean $rtloff = false)
inherited

If the passed value is negative, it is relative to the bottom of the page.

public
since 1.0
see \GetX(),

GetY(), SetY(), SetXY()

Arguments

$y

float

The value of the ordinate in user units.

$resetx

boolean

if true (default) reset the X position.

$rtloff

boolean

if true always uses the page top-left corner as origin of axis.

Skew.

Skew(float $angle_x,float $angle_y,float|null $x = null,float|null $y = null)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$angle_x

float

angle in degrees between -90 (skew to the left) and 90 (skew to the right)

$angle_y

float

angle in degrees between -90 (skew to the bottom) and 90 (skew to the top)

$x

float|null

abscissa of the skewing center. default is current x position

$y

float|null

ordinate of the skewing center. default is current y position

Skew horizontally.

SkewX(float $angle_x,float|null $x = null,float|null $y = null)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$angle_x

float

angle in degrees between -90 (skew to the left) and 90 (skew to the right)

$x

float|null

abscissa of the skewing center. default is current x position

$y

float|null

ordinate of the skewing center. default is current y position

Skew vertically.

SkewY(float $angle_y,float|null $x = null,float|null $y = null)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$angle_y

float

angle in degrees between -90 (skew to the bottom) and 90 (skew to the top)

$x

float|null

abscissa of the skewing center. default is current x position

$y

float|null

ordinate of the skewing center. default is current y position

Sort bookmarks for page and key.

sortBookmarks()
inherited
protected
since 5.9.119

(2011-09-19)

Draws a star polygon

StarPolygon(float $x0,float $y0,float $r,integer $nv,integer $ng,float $angle,boolean $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())
inherited
public
since 2.1.000

(2008-01-08)

Arguments

$x0

float

Abscissa of center point.

$y0

float

Ordinate of center point.

$r

float

Radius of inscribed circle.

$nv

integer

Number of vertices.

$ng

integer

Number of gap (if ($ng % $nv = 1) then is a regular polygon).

$angle

float

Angle oriented (anti-clockwise). Default value: 0.

$draw_circle

boolean

Draw inscribed circle or not. Default value is false.

$style

string

Style of rendering. See the getPathPaintOperator() function for more information.

$line_style

array

Line style of polygon sides. Array with keys among the following:

  • all: Line style of all sides. Array like for SetLineStyle().
  • 0 to (n - 1): Line style of each side. Array like for SetLineStyle().

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

$fill_color

array

Fill color. Format: array(red, green, blue). Default value: default color (empty array).

$circle_style

string

Style of rendering of inscribed circle (if draws). Possible values are:

  • D or empty string: Draw (default).
  • F: Fill.
  • DF or FD: Draw and fill.
  • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
  • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).

$circle_outLine_style

array

Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array).

$circle_fill_color

array

Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array).

Start a new pdf layer.

startLayer(string $name = '',boolean|null $print = true,boolean $view = true,boolean $lock = true)
inherited
public
since 5.9.102

(2011-07-13)

Arguments

$name

string

Layer name (only a-z letters and numbers). Leave empty for automatic name.

$print

boolean|null

Set to TRUE to print this layer, FALSE to not print and NULL to not set this option

$view

boolean

Set to true to view this layer.

$lock

boolean

If true lock the layer

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

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

The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards.

since 4.2.010

(2008-11-14)

see \AddPage(),

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

public

Arguments

$orientation

string

page orientation. Possible values are (case insensitive):

  • P or PORTRAIT (default)
  • L or LANDSCAPE

$format

mixed

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

$tocpage

boolean

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

Create a new page group.

startPageGroup(integer|null $page = null)
inherited

NOTE: call this function before calling AddPage()

public
since 3.0.000

(2008-03-27)

Arguments

$page

integer|null

starting group page (leave empty for next page).

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

startSVGElementHandler(resource|string $parser,string $name,array $attribs,array $ctm = array())
inherited
author

Nicola Asuni

since 5.0.000

(2010-05-02)

protected

Arguments

$parser

resource|string

The first parameter, parser, is a reference to the XML parser calling the handler.

$name

string

The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.

$attribs

array

The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on.

$ctm

array

tranformation matrix for clipping mode (starting transformation matrix).

Start a new XObject Template.

startTemplate(integer $w,integer $h,mixed $group = false): string|false
inherited

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.

author

Nicola Asuni

public
since 5.8.017

(2010-08-24)

see \endTemplate(),

printTemplate()

Arguments

$w

integer

Template width in user units (empty string or zero = page width less margins).

$h

integer

Template height in user units (empty string or zero = page height less margins).

$group

mixed

Set transparency group. Can be a boolean value or an array specifying optional parameters: 'CS' (solour space name), 'I' (boolean flag to indicate isolated group) and 'K' (boolean flag to indicate knockout group).

Response

string|false

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

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

startTransaction()
inherited
public
since 4.5.029

(2009-03-19)

Starts a 2D tranformation saving current graphic state.

StartTransform()
inherited

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.

public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Stops a 2D tranformation restoring previous graphic state.

StopTransform()
inherited

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.

public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Left trim the input string

stringLeftTrim(string $str,string $replace = ''): string
inherited
author

Nicola Asuni

public
since 5.8.000

(2010-08-11)

Arguments

$str

string

string to trim

$replace

string

string that replace spaces.

Response

string

left trimmed string

Right trim the input string

stringRightTrim(string $str,string $replace = ''): string
inherited
author

Nicola Asuni

public
since 5.8.000

(2010-08-11)

Arguments

$str

string

string to trim

$replace

string

string that replace spaces.

Response

string

right trimmed string

Trim the input string

stringTrim(string $str,string $replace = ''): string
inherited
author

Nicola Asuni

public
since 5.8.000

(2010-08-11)

Arguments

$str

string

string to trim

$replace

string

string that replace spaces.

Response

string

trimmed string

Draws an SVG path

SVGPath(string $d,string $style = ''): array
inherited
author

Nicola Asuni

since 5.0.000

(2010-05-02)

protected

Arguments

$d

string

attribute d of the path SVG element

$style

string

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

Response

array

of container box measures (x, y, w, h)

Apply SVG graphic transformation matrix.

SVGTransform(array $tm)
inherited
protected
since 5.0.000

(2010-05-02)

Arguments

$tm

array

original SVG transformation matrix

Swap the left and right margins.

swapMargins(boolean $reverse = true)
inherited
protected
since 4.2.000

(2008-10-29)

Arguments

$reverse

boolean

if true swap left and right margins.

Prints a text cell at the specified position.

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

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

public
since 1.0
see \Cell(),

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

Arguments

$x

float

Abscissa of the cell origin

$y

float

Ordinate of the cell origin

$txt

string

String to print

$fstroke

integer

outline size in user units (0 = disable)

$fclip

boolean

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

$ffill

boolean

if true fills the text

$border

mixed

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

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

$ln

integer

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

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

$align

string

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

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

$fill

boolean

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

$link

mixed

URL or identifier returned by AddLink().

$stretch

integer

font stretch mode:

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

$ignore_min_height

boolean

if true ignore automatic minimum height value.

$calign

string

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

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

$valign

string

text vertical alignment inside the cell. Possible values are:

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

$rtloff

boolean

if true uses the page top-left corner as origin of axis for $x and $y initial position.

Creates a text field

TextField(string $name,float $w,float $h,array $prop = array(),array $opt = array(),float|null $x = null,float|null $y = null,boolean $js = false)
inherited
public
author

Nicola Asuni

since 4.8.000

(2009-09-07)

Arguments

$name

string

field name

$w

float

Width of the rectangle

$h

float

Height of the rectangle

$prop

array

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

$opt

array

annotation parameters. Possible values are described on official PDF32000_2008 reference.

$x

float|null

Abscissa of the upper-left corner of the rectangle

$y

float|null

Ordinate of the upper-left corner of the rectangle

$js

boolean

if true put the field using JavaScript (requires Acrobat Writer to be rendered).

Apply graphic transformations.

Transform(array $tm)
inherited
protected
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$tm

array

transformation matrix

Translate graphic object horizontally and vertically.

Translate(integer $t_x,integer $t_y)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$t_x

integer

movement to the right

$t_y

integer

movement to the bottom

Translate graphic object horizontally.

TranslateX(integer $t_x)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$t_x

integer

movement to the right (or left for RTL)

Translate graphic object vertically.

TranslateY(integer $t_y)
inherited
public
since 2.1.000

(2008-01-07)

see \StartTransform(),

StopTransform()

Arguments

$t_y

integer

movement to the bottom

Reverse function for htmlentities.

unhtmlentities(string $text_to_convert): string
inherited

Convert entities in UTF-8.

public

Arguments

$text_to_convert

string

Text to convert.

Response

string

converted text string

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

unserializeTCPDFtagParameters(string $data): array
inherited
protected

static

Arguments

$data

string

serialized data

Response

array

containing unserialized data

This method prints text from the current position.<br />

Write(float $h,string $txt,mixed $link = '',boolean $fill = false,string $align = '',boolean $ln = false,integer $stretch,boolean $firstline = false,boolean $firstblock = false,float $maxh,float $wadj,array|null $margin = null): mixed
inherited
public
since 1.5

Arguments

$h

float

Line height

$txt

string

String to print

$link

mixed

URL or identifier returned by AddLink()

$fill

boolean

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

$align

string

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

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

$ln

boolean

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

$stretch

integer

font stretch mode:

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

$firstline

boolean

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

$firstblock

boolean

if true the string is the starting of a line.

$maxh

float

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

$wadj

float

first line width will be reduced by this amount (used in HTML mode).

$margin

array|null

margin array of the parent container

Response

mixed

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

Print a Linear Barcode.

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 = '')
inherited
author

Nicola Asuni

since 3.1.000

(2008-06-09)

public

Arguments

$code

string

code to print

$type

string

type of barcode (see tcpdf_barcodes_1d.php for supported formats).

$x

float|null

x position in user units (null = current x position)

$y

float|null

y position in user units (null = current y position)

$w

float|null

width in user units (null = remaining page width)

$h

float|null

height in user units (null = remaining page height)

$xres

float|null

width of the smallest bar in user units (null = default value = 0.4mm)

$style

array

array of options:

  • boolean $style['border'] if true prints a border
  • int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)
  • int $style['hpadding'] horizontal padding in user units (set to 'auto' for automatic padding)
  • int $style['vpadding'] vertical padding in user units (set to 'auto' for automatic padding)
  • array $style['fgcolor'] color array for bars and text
  • mixed $style['bgcolor'] color array for background (set to false for transparent)
  • boolean $style['text'] if true prints text below the barcode
  • string $style['label'] override default label
  • string $style['font'] font name for text
  • int $style['fontsize'] font size for text
  • int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing.
  • string $style['position'] horizontal position of the containing barcode cell on the page: L = left margin; C = center; R = right margin.
  • string $style['align'] horizontal position of the barcode on the containing rectangle: L = left; C = center; R = right.
  • string $style['stretch'] if true stretch the barcode to best fit the available width, otherwise uses $xres resolution for a single bar.
  • string $style['fitwidth'] if true reduce the width to fit the barcode width + padding. When this option is enabled the 'stretch' option is automatically disabled.
  • string $style['cellfitalign'] this option works only when 'fitwidth' is true and 'position' is unset or empty. Set the horizontal position of the containing barcode cell inside the specified rectangle: L = left; C = center; R = right.

$align

string

Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

Print 2D Barcode.

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 = '',boolean $distort = false)
inherited
author

Nicola Asuni

since 4.5.037

(2009-04-07)

public

Arguments

$code

string

code to print

$type

string

type of barcode (see tcpdf_barcodes_2d.php for supported formats).

$x

float|null

x position in user units

$y

float|null

y position in user units

$w

float|null

width in user units

$h

float|null

height in user units

$style

array

array of options:

  • boolean $style['border'] if true prints a border around the barcode
  • int $style['padding'] padding to leave around the barcode in barcode units (set to 'auto' for automatic padding)
  • int $style['hpadding'] horizontal padding in barcode units (set to 'auto' for automatic padding)
  • int $style['vpadding'] vertical padding in barcode units (set to 'auto' for automatic padding)
  • int $style['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

$align

string

Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:

  • T: top-right for LTR or top-left for RTL
  • M: middle-right for LTR or middle-left for RTL
  • B: bottom-right for LTR or bottom-left for RTL
  • N: next line

$distort

boolean

if true distort the barcode to fit width and height, otherwise preserve aspect ratio

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

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

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.

public

Arguments

$html

string

text to display

$ln

boolean

if true add a new line after text (default = true)

$fill

boolean

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

$reseth

boolean

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

$cell

boolean

if true add the current left (or right for RTL) padding to each Write (default false).

$align

string

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

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

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

writeHTMLCell(float $w,float $h,float|null $x,float|null $y,string $html = '',mixed $border,integer $ln,boolean $fill = false,boolean $reseth = true,string $align = '',boolean $autopadding = true)
inherited

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.

see \Multicell(),

writeHTML()

public

Arguments

$w

float

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

$h

float

Cell minimum height. The cell extends automatically if needed.

$x

float|null

upper-left corner X coordinate

$y

float|null

upper-left corner Y coordinate

$html

string

html text to print. Default value: empty string.

$border

mixed

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

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

$ln

integer

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

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

$fill

boolean

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

$reseth

boolean

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

$align

string

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

  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

$autopadding

boolean

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

Properties

Current page number.

page :
inherited
protected

Type(s)

Current object number.

n :
inherited
protected

Type(s)

Array of object offsets.

offsets :
inherited
protected

Type(s)

Array of object IDs for each page.

pageobjects :
inherited
protected

Type(s)

Buffer holding in-memory PDF.

buffer :
inherited
protected

Type(s)

Array containing pages.

pages :
inherited
protected

Type(s)

Current document state.

state :
inherited
protected

Type(s)

Compression flag.

compress :
inherited
protected

Type(s)

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

CurOrientation :
inherited
protected

Type(s)

Page dimensions.

pagedim :
inherited
protected

Type(s)

Scale factor (number of points in user unit).

k :
inherited
protected

Type(s)

Width of page format in points.

fwPt :
inherited
protected

Type(s)

Height of page format in points.

fhPt :
inherited
protected

Type(s)

Current width of page in points.

wPt :
inherited
protected

Type(s)

Current height of page in points.

hPt :
inherited
protected

Type(s)

Current width of page in user unit.

w :
inherited
protected

Type(s)

Current height of page in user unit.

h :
inherited
protected

Type(s)

Left margin.

lMargin :
inherited
protected

Type(s)

Right margin.

rMargin :
inherited
protected

Type(s)

Cell left margin (used by regions).

clMargin :
inherited
protected

Type(s)

Cell right margin (used by regions).

crMargin :
inherited
protected

Type(s)

Top margin.

tMargin :
inherited
protected

Type(s)

Page break margin.

bMargin :
inherited
protected

Type(s)

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

cell_padding :
inherited
since

(2010-10-03)

protected

Type(s)

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

cell_margin :
inherited
since

(2010-10-04)

protected

Type(s)

Current horizontal position in user unit for cell positioning.

x :
inherited
protected

Type(s)

Current vertical position in user unit for cell positioning.

y :
inherited
protected

Type(s)

Height of last cell printed.

lasth :
inherited
protected

Type(s)

Line width in user unit.

LineWidth :
inherited
protected

Type(s)

Array of standard font names.

CoreFonts :
inherited
protected

Type(s)

Array of used fonts.

fonts :
inherited
protected

Type(s)

Array of font files.

FontFiles :
inherited
protected

Type(s)

Array of encoding differences.

diffs :
inherited
protected

Type(s)

Array of used images.

images :
inherited
protected

Type(s)

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

svg_tag_depth :
inherited
protected

Type(s)

Array of Annotations in pages.

PageAnnots :
inherited
protected

Type(s)

Current font family.

FontFamily :
inherited
protected

Type(s)

Current font style.

FontStyle :
inherited
protected

Type(s)

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

FontAscent :
inherited
protected
since

(2007-03-29)

Type(s)

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

FontDescent :
inherited
protected
since

(2007-03-29)

Type(s)

Underlining flag.

underline :
inherited
protected

Type(s)

Overlining flag.

overline :
inherited
protected

Type(s)

Current font info.

CurrentFont :
inherited
protected

Type(s)

Current font size in points.

FontSizePt :
inherited
protected

Type(s)

Current font size in user unit.

FontSize :
inherited
protected

Type(s)

Commands for drawing color.

DrawColor :
inherited
protected

Type(s)

Commands for filling color.

FillColor :
inherited
protected

Type(s)

Commands for text color.

TextColor :
inherited
protected

Type(s)

Indicates whether fill and text colors are different.

ColorFlag :
inherited
protected

Type(s)

Automatic page breaking.

AutoPageBreak :
inherited
protected

Type(s)

Threshold used to trigger page breaks.

PageBreakTrigger :
inherited
protected

Type(s)

Flag set when processing page header.

InHeader :
inherited
protected

Type(s)

Flag set when processing page footer.

InFooter :
inherited
protected

Type(s)

Zoom display mode.

ZoomMode :
inherited
protected

Type(s)

Layout display mode.

LayoutMode :
inherited
protected

Type(s)

If true set the document information dictionary in Unicode.

docinfounicode :
inherited
protected

Type(s)

Document title.

title :
inherited
protected

Type(s)

Document subject.

subject :
inherited
protected

Type(s)

Document author.

author :
inherited
protected

Type(s)

Document keywords.

keywords :
inherited
protected

Type(s)

Document creator.

creator :
inherited
protected

Type(s)

Starting page number.

starting_page_number :
inherited
protected

Type(s)

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

img_rb_x :
inherited
since
author

Nicola Asuni

protected

Type(s)

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

img_rb_y :
inherited
since
author

Nicola Asuni

protected

Type(s)

Adjusting factor to convert pixels to user units.

imgscale :
inherited
since
author

Nicola Asuni

protected

Type(s)

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

isunicode :
inherited
since
author

Nicola Asuni

protected

Type(s)

PDF version.

PDFVersion :
inherited
since
protected

Type(s)

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

header_xobjid :
inherited
protected

Type(s)

If true reset the Header Xobject template at each page

header_xobj_autoreset :
inherited
protected

Type(s)

Minimum distance between header and top page margin.

header_margin :
inherited
protected

Type(s)

Original left margin value.

original_lMargin :
inherited
protected
since

Type(s)

Original right margin value.

original_rMargin :
inherited
protected
since

Type(s)

Default font used on page header.

header_font :\array<int,string|float|\null>
inherited
protected
var
phpstan-var

array{0: string, 1: string, 2: float|null}

Type(s)

\array

Language templates.

l :
inherited
protected

Type(s)

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

barcode :
inherited
protected

Type(s)

Boolean flag to print/hide page header.

print_header :
inherited
protected

Type(s)

Width of header image logo in user units.

header_logo_width :
inherited
protected

Type(s)

Title to be printed on default page header.

header_title :
inherited
protected

Type(s)

String to print on page header after title.

header_string :
inherited
protected

Type(s)

Color for header text (RGB array).

header_text_color :array<mixed,integer>
inherited
since

(2012-07-25)

protected
var
phpstan-var

array{0: int, 1: int, 2: int}

Type(s)

array<mixed,integer>

Color for header line (RGB array).

header_line_color :array<mixed,integer>
inherited
since

(2012-07-25)

protected
var
phpstan-var

array{0: int, 1: int, 2: int}

Type(s)

array<mixed,integer>

Text shadow data array.

txtshadow :
inherited
since

(2012-07-25)

protected

Type(s)

Default number of columns for html table.

default_table_columns :
inherited
protected

Type(s)

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

HREF :
inherited
protected

Type(s)

List of available fonts on filesystem.

fontlist :
inherited
protected

Type(s)

Current foreground color.

fgcolor :
inherited
protected

Type(s)

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

listordered :
inherited
protected

Type(s)

HTML PARSER: array count list items on nested lists.

listcount :
inherited
protected

Type(s)

HTML PARSER: current list nesting level.

listnum :
inherited
protected

Type(s)

HTML PARSER: indent amount for lists.

listindent :
inherited
protected

Type(s)

HTML PARSER: current list indententation level.

listindentlevel :
inherited
protected

Type(s)

Current background color.

bgcolor :
inherited
protected

Type(s)

Temporary font size in points.

tempfontsize :
inherited
protected

Type(s)

Spacer string for LI tags.

lispacer :
inherited
protected

Type(s)

Default encoding.

encoding :
inherited
protected
since

Type(s)

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

rtl :
inherited
protected
since

Type(s)

Boolean flag used to force RTL or LTR string direction.

tmprtl :
inherited
protected
since

Type(s)

IBoolean flag indicating whether document is protected.

encrypted :
inherited
protected
since

(2008-01-02)

Type(s)

Array containing encryption settings.

encryptdata :
inherited
protected
since

(2010-05-11)

Type(s)

Last RC4 key encrypted (cached for optimisation).

last_enc_key :
inherited
protected
since

(2008-01-02)

Type(s)

Last RC4 computed key.

last_enc_key_c :
inherited
protected
since

(2008-01-02)

Type(s)

File ID (used on document trailer).

file_id :
inherited
protected
since

(2010-05-12)

Type(s)

Outlines for bookmark.

outlines :
inherited
protected
since

(2008-02-12)

Type(s)

Outline root for bookmark.

OutlineRoot :
inherited
protected
since

(2008-02-12)

Type(s)

Javascript code.

javascript :
inherited
protected
since

(2008-02-12)

Type(s)

Javascript counter.

n_js :
inherited
protected
since

(2008-02-12)

Type(s)

line through state

linethrough :
inherited
protected
since

(2008-03-19)

Type(s)

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

ur :
inherited
protected
since

(2010-08-23)

Type(s)

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

dpi :
inherited
protected
since

(2008-03-27)

Type(s)

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

newpagegroup :
inherited
protected
since

(2008-03-27)

Type(s)

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

pagegroups :
inherited
protected
since

(2008-03-27)

Type(s)

Current page group number.

currpagegroup :
inherited
protected
since

(2008-03-27)

Type(s)

Array of transparency objects and parameters.

extgstates :
inherited
protected
since

(2008-03-27)

Type(s)

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

jpeg_quality :
inherited
protected
since

(2008-03-27)

Type(s)

Default cell height ratio.

cell_height_ratio :float
inherited
protected
since

(2008-05-23)

var

Type(s)

float

PDF viewer preferences.

viewer_preferences :
inherited
protected
since

(2008-06-09)

Type(s)

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

PageMode :
inherited
protected
since

(2008-06-09)

Type(s)

Array for storing gradient information.

gradients :
inherited
protected
since

(2008-06-09)

Type(s)

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

intmrk :
inherited
protected
since

(2008-06-26)

Type(s)

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

bordermrk :
inherited
protected
since

(2010-08-03)

Type(s)

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

emptypagemrk :
inherited
protected
since

(2010-08-18)

Type(s)

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

cntmrk :
inherited
protected
since

(2009-07-20)

Type(s)

Array used to store footer positions of each page.

footerpos :
inherited
protected
since

(2008-07-01)

Type(s)

Array used to store footer length of each page.

footerlen :
inherited
protected
since

(2008-07-29)

Type(s)

Boolean flag to indicate if a new line is created.

newline :
inherited
protected
since

(2008-07-01)

Type(s)

End position of the latest inserted line.

endlinex :
inherited
protected
since

(2008-07-01)

Type(s)

PDF string for width value of the last line.

linestyleWidth :
inherited
protected
since

(2008-07-16)

Type(s)

PDF string for CAP value of the last line.

linestyleCap :
inherited
protected
since

(2008-07-16)

Type(s)

PDF string for join value of the last line.

linestyleJoin :
inherited
protected
since

(2008-07-16)

Type(s)

PDF string for dash value of the last line.

linestyleDash :
inherited
protected
since

(2008-07-16)

Type(s)

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

openMarkedContent :
inherited
protected
since

(2008-07-28)

Type(s)

Count the latest inserted vertical spaces on HTML.

htmlvspace :
inherited
protected
since

(2008-08-24)

Type(s)

Array of Spot colors.

spot_colors :
inherited
protected
since

(2008-09-12)

Type(s)

Symbol used for HTML unordered list items.

lisymbol :
inherited
protected
since

(2008-09-26)

Type(s)

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

epsmarker :
inherited
protected
since

(2008-10-18)

Type(s)

Array of transformation matrix.

transfmatrix :
inherited
protected
since

(2008-10-29)

Type(s)

Current key for transformation matrix.

transfmatrix_key :
inherited
protected
since

(2009-09-17)

Type(s)

Booklet mode for double-sided pages.

booklet :
inherited
protected
since

(2008-10-29)

Type(s)

Epsilon value used for float calculations.

feps :
inherited
protected
since

(2008-10-29)

Type(s)

Array used for custom vertical spaces for HTML tags.

tagvspaces :
inherited
protected
since

(2008-10-30)

Type(s)

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

customlistindent :
inherited
protected
since

(2008-11-12)

Type(s)

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

opencell :
inherited
protected
since

(2008-11-14)

Type(s)

Array of files to embedd.

embeddedfiles :
inherited
protected
since

(2008-12-07)

Type(s)

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

premode :
inherited
protected
since

(2008-12-08)

Type(s)

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

transfmrk :
inherited

keys are the page numbers

protected
since

(2008-12-09)

Type(s)

Default color for html links.

htmlLinkColorArray :
inherited
protected
since

(2008-12-09)

Type(s)

Default font style to add to html links.

htmlLinkFontStyle :
inherited
protected
since

(2008-12-09)

Type(s)

Counts the number of pages.

numpages :
inherited
protected
since

(2008-12-31)

Type(s)

Array containing page lengths in bytes.

pagelen :
inherited
protected
since

(2008-12-31)

Type(s)

Counts the number of pages.

numimages :
inherited
protected
since

(2008-12-31)

Type(s)

Store the image keys.

imagekeys :
inherited
protected
since

(2008-12-31)

Type(s)

Length of the buffer in bytes.

bufferlen :
inherited
protected
since

(2008-12-31)

Type(s)

Counts the number of fonts.

numfonts :
inherited
protected
since

(2009-01-02)

Type(s)

Store the font keys.

fontkeys :
inherited
protected
since

(2009-01-02)

Type(s)

Store the font object IDs.

font_obj_ids :
inherited
protected
since

(2009-09-09)

Type(s)

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

pageopen :
inherited
protected
since

(2009-01-02)

Type(s)

Default monospace font.

default_monospaced_font :
inherited
protected
since

(2009-03-10)

Type(s)

Cloned copy of the current class object.

objcopy :
inherited
protected
since

(2009-03-19)

Type(s)

Array used to store the lengths of cache files.

cache_file_length :
inherited
protected
since

(2009-03-19)

Type(s)

Table header content to be repeated on each new page.

thead :
inherited
protected
since

(2009-03-20)

Type(s)

Margins used for table header.

theadMargins :
inherited
protected
since

(2009-03-20)

Type(s)

Boolean flag to enable document digital signature.

sign :
inherited
protected
since

(2009-04-24)

Type(s)

Digital signature data.

signature_data :
inherited
protected
since

(2009-04-24)

Type(s)

Digital signature max length.

signature_max_length :
inherited
protected
since

(2009-04-24)

Type(s)

Data for digital signature appearance.

signature_appearance :
inherited
protected
since

(2010-06-16)

Type(s)

Array of empty digital signature appearances.

empty_signature_appearance :
inherited
protected
since

(2011-07-06)

Type(s)

Boolean flag to enable document timestamping with TSA.

tsa_timestamp :
inherited
protected
since

(2014-06-19)

Type(s)

Timestamping data.

tsa_data :
inherited
protected
since

(2014-06-19)

Type(s)

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

re_spaces :
inherited
protected
since

(2009-04-28)

Type(s)

Array of $re_spaces parts.

re_space :
inherited
protected
since

(2010-07-09)

Type(s)

Digital signature object ID.

sig_obj_id :
inherited
protected
since

(2009-06-23)

Type(s)

ID of page objects.

page_obj_id :
inherited
protected
since

(2009-08-29)

Type(s)

List of form annotations IDs.

form_obj_id :
inherited
protected
since

(2009-09-07)

Type(s)

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.

default_form_prop :
inherited
protected
since

(2009-09-07)

Type(s)

Javascript objects array.

js_objects :
inherited
protected
since

(2009-09-07)

Type(s)

Current form action (used during XHTML rendering).

form_action :
inherited
protected
since

(2009-09-07)

Type(s)

Current form encryption type (used during XHTML rendering).

form_enctype :
inherited
protected
since

(2009-09-07)

Type(s)

Current method to submit forms.

form_mode :
inherited
protected
since

(2009-09-07)

Type(s)

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

annotation_fonts :
inherited
protected
since

(2009-09-09)

Type(s)

List of radio buttons parent objects.

radiobutton_groups :
inherited
protected
since

(2009-09-09)

Type(s)

List of radio group objects IDs.

radio_groups :
inherited
protected
since

(2009-09-09)

Type(s)

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

textindent :
inherited
protected
since

(2009-09-23)

Type(s)

Store page number when startTransaction() is called.

start_transaction_page :
inherited
protected
since

(2009-09-23)

Type(s)

Store Y position when startTransaction() is called.

start_transaction_y :
inherited
protected
since

(2010-03-28)

Type(s)

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

inthead :
inherited
protected
since

(2010-01-25)

Type(s)

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

columns :
inherited
protected
since

(2010-03-28)

Type(s)

Number of colums.

num_columns :
inherited
protected
since

(2010-03-28)

Type(s)

Current column number.

current_column :
inherited
protected
since

(2010-03-28)

Type(s)

Starting page for columns.

column_start_page :
inherited
protected
since

(2010-03-28)

Type(s)

Maximum page and column selected.

maxselcol :
inherited
protected
since

(2010-08-11)

Type(s)

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

colxshift :
inherited
protected
since

(2010-08-11)

Type(s)

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.

textrendermode :
inherited
protected
since

(2010-04-03)

Type(s)

Text stroke width in doc units.

textstrokewidth :
inherited
protected
since

(2010-04-03)

Type(s)

Current stroke color.

strokecolor :
inherited
protected
since

(2010-04-03)

Type(s)

Default unit of measure for document.

pdfunit :
inherited
protected
since

(2010-04-22)

Type(s)

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

tocpage :
inherited
protected

Type(s)

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

rasterize_vector_images :
inherited
protected
since

(2010-04-26)

Type(s)

Boolean flag: if true enables font subsetting by default.

font_subsetting :
inherited
protected
since

(2010-06-07)

Type(s)

Array of default graphic settings.

default_graphic_vars :
inherited
protected
since

(2010-07-02)

Type(s)

Array of XObjects.

xobjects :
inherited
protected
since

(2010-08-23)

Type(s)

Boolean value true when we are inside an XObject.

inxobj :
inherited
protected
since

(2010-08-24)

Type(s)

Current XObject ID.

xobjid :
inherited
protected
since

(2010-08-24)

Type(s)

Percentage of character stretching.

font_stretching :
inherited
protected
since

(2010-09-29)

Type(s)

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

font_spacing :
inherited
protected
since

(2010-09-29)

Type(s)

Array of no-write regions.

page_regions :
inherited

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

protected
since

(2010-10-14)

Type(s)

Boolean value true when page region check is active.

check_page_regions :
inherited
protected

Type(s)

Array of PDF layers data.

pdflayers :
inherited
protected
since

(2011-07-13)

Type(s)

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

dests :
inherited
protected
since

(2011-06-23)

Type(s)

Object ID for Named Destinations

n_dests :
inherited
protected
since

(2011-06-23)

Type(s)

Embedded Files Names

efnames :
inherited
protected
since

(2013-01-23)

Type(s)

Directory used for the last SVG image.

svgdir :
inherited
protected
since

(2010-05-05)

Type(s)

Deafult unit of measure for SVG.

svgunit :
inherited
protected
since

(2010-05-02)

Type(s)

Array of SVG gradients.

svggradients :
inherited
protected
since

(2010-05-02)

Type(s)

ID of last SVG gradient.

svggradientid :
inherited
protected
since

(2010-05-02)

Type(s)

Boolean value true when in SVG defs group.

svgdefsmode :
inherited
protected
since

(2010-05-02)

Type(s)

Array of SVG defs.

svgdefs :
inherited
protected
since

(2010-05-02)

Type(s)

Boolean value true when in SVG clipPath tag.

svgclipmode :
inherited
protected
since

(2010-04-26)

Type(s)

Array of SVG clipPath commands.

svgclippaths :
inherited
protected
since

(2010-05-02)

Type(s)

Array of SVG clipPath tranformation matrix.

svgcliptm :
inherited
protected
since

(2010-08-31)

Type(s)

ID of last SVG clipPath.

svgclipid :
inherited
protected
since

(2010-05-02)

Type(s)

SVG text.

svgtext :
inherited
protected
since

(2010-05-02)

Type(s)

SVG text properties.

svgtextmode :
inherited
protected
since

(2010-08-23)

Type(s)

Array of SVG properties.

svgstyles :
inherited
protected
since

(2010-05-02)

Type(s)

If true force sRGB color profile for all document.

force_srgb :
inherited
protected
since

(2011-09-28)

Type(s)

If true set the document to PDF/A mode.

pdfa_mode :
inherited
protected
since

(2011-09-27)

Type(s)

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

pdfa_version :
inherited
protected
since

(2019-03-12)

Type(s)

Document creation date-time

doc_creation_timestamp :
inherited
protected
since

(2012-03-22)

Type(s)

Document modification date-time

doc_modification_timestamp :
inherited
protected
since

(2012-03-22)

Type(s)

Custom XMP data.

custom_xmp :
inherited
protected
since

(2011-10-06)

Type(s)

Custom XMP RDF data.

custom_xmp_rdf :
inherited
protected
since

(2019-09-19)

Type(s)

Overprint mode array.

overprint :\array<string,bool|\int>
inherited

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

protected
since

(2012-03-23)

var

Type(s)

\array

Alpha mode array.

alpha :
inherited

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

protected
since

(2012-03-23)

Type(s)

Define the page boundaries boxes to be set on document.

page_boxes :
inherited
protected
since

(2012-03-23)

Type(s)

Cache array for computed GD gamma values.

gdgammacache :
inherited
protected
since

(2012-06-05)

Type(s)

Cache array for file content

fileContentCache :array
inherited
protected
var
since

(2020-09-28)

Type(s)

array

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

allowLocalFiles :boolean
inherited
var
protected
since

(2020-07-23)

Type(s)

boolean

cleaned_ids

cleaned_ids :
inheritedstatic

Type(s)