TCPDF
class TCPDF (View source)
Properties
protected | $page | Current page number. |
|
protected | $n | Current object number. |
|
protected | $offsets | Array of object offsets. |
|
protected | $pageobjects | Array of object IDs for each page. |
|
protected | $buffer | Buffer holding in-memory PDF. |
|
protected | $pages | Array containing pages. |
|
protected | $state | Current document state. |
|
protected | $compress | Compression flag. |
|
protected | $CurOrientation | Current page orientation (P = Portrait, L = Landscape). |
|
protected | $pagedim | Page dimensions. |
|
protected | $k | Scale factor (number of points in user unit). |
|
protected | $fwPt | Width of page format in points. |
|
protected | $fhPt | Height of page format in points. |
|
protected | $wPt | Current width of page in points. |
|
protected | $hPt | Current height of page in points. |
|
protected | $w | Current width of page in user unit. |
|
protected | $h | Current height of page in user unit. |
|
protected | $lMargin | Left margin. |
|
protected | $rMargin | Right margin. |
|
protected | $clMargin | Cell left margin (used by regions). |
|
protected | $crMargin | Cell right margin (used by regions). |
|
protected | $tMargin | Top margin. |
|
protected | $bMargin | Page break margin. |
|
protected
Since: 5.9.000 (2010-10-03)
|
$cell_padding | Array of cell internal paddings ('T' => top, 'R' => right, 'B' => bottom, 'L' => left). |
|
protected
Since: 5.9.000 (2010-10-04)
|
$cell_margin | Array of cell margins ('T' => top, 'R' => right, 'B' => bottom, 'L' => left). |
|
protected | $x | Current horizontal position in user unit for cell positioning. |
|
protected | $y | Current vertical position in user unit for cell positioning. |
|
protected | $lasth | Height of last cell printed. |
|
protected | $LineWidth | Line width in user unit. |
|
protected | $CoreFonts | Array of standard font names. |
|
protected | $fonts | Array of used fonts. |
|
protected | $FontFiles | Array of font files. |
|
protected | $diffs | Array of encoding differences. |
|
protected | $images | Array of used images. |
|
protected | $svg_tag_depth | Depth of the svg tag, to keep track if the svg tag is a subtag or the root tag. |
|
protected | $PageAnnots | Array of Annotations in pages. |
|
protected | $links | Array of internal links. |
|
protected | $FontFamily | Current font family. |
|
protected | $FontStyle | Current font style. |
|
protected
Since: 2.8.000 (2007-03-29)
|
$FontAscent | Current font ascent (distance between font top and baseline). |
|
protected
Since: 2.8.000 (2007-03-29)
|
$FontDescent | Current font descent (distance between font bottom and baseline). |
|
protected | $underline | Underlining flag. |
|
protected | $overline | Overlining flag. |
|
protected | $CurrentFont | Current font info. |
|
protected | $FontSizePt | Current font size in points. |
|
protected | $FontSize | Current font size in user unit. |
|
protected | $DrawColor | Commands for drawing color. |
|
protected | $FillColor | Commands for filling color. |
|
protected | $TextColor | Commands for text color. |
|
protected | $ColorFlag | Indicates whether fill and text colors are different. |
|
protected | $AutoPageBreak | Automatic page breaking. |
|
protected | $PageBreakTrigger | Threshold used to trigger page breaks. |
|
protected | $InHeader | Flag set when processing page header. |
|
protected | $InFooter | Flag set when processing page footer. |
|
protected | $ZoomMode | Zoom display mode. |
|
protected | $LayoutMode | Layout display mode. |
|
protected | $docinfounicode | If true set the document information dictionary in Unicode. |
|
protected | $title | Document title. |
|
protected | $subject | Document subject. |
|
protected | $author | Document author. |
|
protected | $keywords | Document keywords. |
|
protected | $creator | Document creator. |
|
protected | $starting_page_number | Starting page number. |
|
protected
Since: 2002-07-31
|
$img_rb_x | The right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image. |
|
protected
Since: 2002-07-31
|
$img_rb_y | The right-bottom corner Y coordinate of last inserted image. |
|
protected
Since: 2004-06-14
|
$imgscale | Adjusting factor to convert pixels to user units. |
|
protected
Since: 2005-01-02
|
$isunicode | Boolean flag set to true when the input text is unicode (require unicode fonts). |
|
protected
Since: 1.5.3
|
$PDFVersion | PDF version. |
|
protected | $header_xobjid | ID of the stored default header template (-1 = not set). |
|
protected | $header_xobj_autoreset | If true reset the Header Xobject template at each page |
|
protected float | $header_margin | Minimum distance between header and top page margin. |
|
protected float | $footer_margin | Minimum distance between footer and bottom page margin. |
|
protected
Since: 1.53.0.TC013
|
$original_lMargin | Original left margin value. |
|
protected
Since: 1.53.0.TC013
|
$original_rMargin | Original right margin value. |
|
protected array<int,string|float|null> | $header_font | Default font used on page header. |
|
protected array<int,string|float|null> | $footer_font | Default font used on page footer. |
|
protected | $l | Language templates. |
|
protected | $barcode | Barcode to print on page footer (only if set). |
|
protected | $print_header | Boolean flag to print/hide page header. |
|
protected | $print_footer | Boolean flag to print/hide page footer. |
|
protected | $header_logo | Header image logo. |
|
protected | $header_logo_width | Width of header image logo in user units. |
|
protected | $header_title | Title to be printed on default page header. |
|
protected | $header_string | String to print on page header after title. |
|
protected int[]
Since: 5.9.174 (2012-07-25)
|
$header_text_color | Color for header text (RGB array). |
|
protected int[]
Since: 5.9.174 (2012-07-25)
|
$header_line_color | Color for header line (RGB array). |
|
protected int[]
Since: 5.9.174 (2012-07-25)
|
$footer_text_color | Color for footer text (RGB array). |
|
protected int[]
Since: 5.9.174 (2012-07-25)
|
$footer_line_color | Color for footer line (RGB array). |
|
protected
Since: 5.9.174 (2012-07-25)
|
$txtshadow | Text shadow data array. |
|
protected | $default_table_columns | Default number of columns for html table. |
|
protected | $HREF | HTML PARSER: array to store current link and rendering styles. |
|
protected | $fontlist | List of available fonts on filesystem. |
|
protected | $fgcolor | Current foreground color. |
|
protected | $listordered | HTML PARSER: array of boolean values, true in case of ordered list (OL), false otherwise. |
|
protected | $listcount | HTML PARSER: array count list items on nested lists. |
|
protected | $listnum | HTML PARSER: current list nesting level. |
|
protected | $listindent | HTML PARSER: indent amount for lists. |
|
protected | $listindentlevel | HTML PARSER: current list indententation level. |
|
protected | $bgcolor | Current background color. |
|
protected | $tempfontsize | Temporary font size in points. |
|
protected | $lispacer | Spacer string for LI tags. |
|
protected
Since: 1.53.0.TC010
|
$encoding | Default encoding. |
|
protected
Since: 2.0.000
|
$rtl | Boolean flag to indicate if the document language is Right-To-Left. |
|
protected
Since: 2.0.000
|
$tmprtl | Boolean flag used to force RTL or LTR string direction. |
|
protected
Since: 2.0.000 (2008-01-02)
|
$encrypted | IBoolean flag indicating whether document is protected. |
|
protected
Since: 5.0.005 (2010-05-11)
|
$encryptdata | Array containing encryption settings. |
|
protected
Since: 2.0.000 (2008-01-02)
|
$last_enc_key | Last RC4 key encrypted (cached for optimisation). |
|
protected
Since: 2.0.000 (2008-01-02)
|
$last_enc_key_c | Last RC4 computed key. |
|
protected
Since: 5.0.005 (2010-05-12)
|
$file_id | File ID (used on document trailer). |
|
protected
Since: 6.7.5 (2024-03-21)
|
$hash_key | Internal secret used to encrypt data. |
|
protected
Since: 2.1.002 (2008-02-12)
|
$outlines | Outlines for bookmark. |
|
protected
Since: 2.1.002 (2008-02-12)
|
$OutlineRoot | Outline root for bookmark. |
|
protected
Since: 2.1.002 (2008-02-12)
|
$javascript | Javascript code. |
|
protected
Since: 2.1.002 (2008-02-12)
|
$n_js | Javascript counter. |
|
protected
Since: 2.8.000 (2008-03-19)
|
$linethrough | line through state |
|
protected
Since: 5.8.014 (2010-08-23)
|
$ur | Array with additional document-wide usage rights for the document. |
|
protected
Since: 3.0.000 (2008-03-27)
|
$dpi | DPI (Dot Per Inch) Document Resolution (do not change). |
|
protected
Since: 3.0.000 (2008-03-27)
|
$newpagegroup | Array of page numbers were a new page group was started (the page numbers are the keys of the array). |
|
protected
Since: 3.0.000 (2008-03-27)
|
$pagegroups | Array that contains the number of pages in each page group. |
|
protected
Since: 3.0.000 (2008-03-27)
|
$currpagegroup | Current page group number. |
|
protected
Since: 3.0.000 (2008-03-27)
|
$extgstates | Array of transparency objects and parameters. |
|
protected
Since: 3.0.000 (2008-03-27)
|
$jpeg_quality | Set the default JPEG compression quality (1-100). |
|
protected float
Since: 3.0.014 (2008-05-23)
|
$cell_height_ratio | Default cell height ratio. |
|
protected
Since: 3.1.000 (2008-06-09)
|
$viewer_preferences | PDF viewer preferences. |
|
protected
Since: 3.1.000 (2008-06-09)
|
$PageMode | A name object specifying how the document should be displayed when opened. |
|
protected
Since: 3.1.000 (2008-06-09)
|
$gradients | Array for storing gradient information. |
|
protected
Since: 3.2.000 (2008-06-26)
|
$intmrk | Array used to store positions inside the pages buffer (keys are the page numbers). |
|
protected
Since: 5.7.000 (2010-08-03)
|
$bordermrk | Array used to store positions inside the pages buffer (keys are the page numbers). |
|
protected
Since: 5.8.007 (2010-08-18)
|
$emptypagemrk | Array used to store page positions to track empty pages (keys are the page numbers). |
|
protected
Since: 4.6.021 (2009-07-20)
|
$cntmrk | Array used to store content positions inside the pages buffer (keys are the page numbers). |
|
protected
Since: 3.2.000 (2008-07-01)
|
$footerpos | Array used to store footer positions of each page. |
|
protected
Since: 4.0.014 (2008-07-29)
|
$footerlen | Array used to store footer length of each page. |
|
protected
Since: 3.2.000 (2008-07-01)
|
$newline | Boolean flag to indicate if a new line is created. |
|
protected
Since: 3.2.000 (2008-07-01)
|
$endlinex | End position of the latest inserted line. |
|
protected
Since: 4.0.006 (2008-07-16)
|
$linestyleWidth | PDF string for width value of the last line. |
|
protected
Since: 4.0.006 (2008-07-16)
|
$linestyleCap | PDF string for CAP value of the last line. |
|
protected
Since: 4.0.006 (2008-07-16)
|
$linestyleJoin | PDF string for join value of the last line. |
|
protected
Since: 4.0.006 (2008-07-16)
|
$linestyleDash | PDF string for dash value of the last line. |
|
protected
Since: 4.0.013 (2008-07-28)
|
$openMarkedContent | Boolean flag to indicate if marked-content sequence is open. |
|
protected
Since: 4.0.021 (2008-08-24)
|
$htmlvspace | Count the latest inserted vertical spaces on HTML. |
|
protected
Since: 4.0.024 (2008-09-12)
|
$spot_colors | Array of Spot colors. |
|
protected
Since: 4.0.028 (2008-09-26)
|
$lisymbol | Symbol used for HTML unordered list items. |
|
protected
Since: 4.1.000 (2008-10-18)
|
$epsmarker | String used to mark the beginning and end of EPS image blocks. |
|
protected
Since: 4.2.000 (2008-10-29)
|
$transfmatrix | Array of transformation matrix. |
|
protected
Since: 4.8.005 (2009-09-17)
|
$transfmatrix_key | Current key for transformation matrix. |
|
protected
Since: 4.2.000 (2008-10-29)
|
$booklet | Booklet mode for double-sided pages. |
|
protected
Since: 4.2.000 (2008-10-29)
|
$feps | Epsilon value used for float calculations. |
|
protected
Since: 4.2.001 (2008-10-30)
|
$tagvspaces | Array used for custom vertical spaces for HTML tags. |
|
protected
Since: 4.2.007 (2008-11-12)
|
$customlistindent | HTML PARSER: custom indent amount for lists. Negative value means disabled. |
|
protected
Since: 4.2.010 (2008-11-14)
|
$opencell | Boolean flag to indicate if the border of the cell sides that cross the page should be removed. |
|
protected
Since: 4.4.000 (2008-12-07)
|
$embeddedfiles | Array of files to embedd. |
|
protected
Since: 4.4.001 (2008-12-08)
|
$premode | Boolean flag to indicate if we are inside a PRE tag. |
|
protected
Since: 4.4.002 (2008-12-09)
|
$transfmrk | Array used to store positions of graphics transformation blocks inside the page buffer. |
|
protected
Since: 4.4.003 (2008-12-09)
|
$htmlLinkColorArray | Default color for html links. |
|
protected
Since: 4.4.003 (2008-12-09)
|
$htmlLinkFontStyle | Default font style to add to html links. |
|
protected
Since: 4.5.000 (2008-12-31)
|
$numpages | Counts the number of pages. |
|
protected
Since: 4.5.000 (2008-12-31)
|
$pagelen | Array containing page lengths in bytes. |
|
protected
Since: 4.5.000 (2008-12-31)
|
$numimages | Counts the number of pages. |
|
protected
Since: 4.5.000 (2008-12-31)
|
$imagekeys | Store the image keys. |
|
protected
Since: 4.5.000 (2008-12-31)
|
$bufferlen | Length of the buffer in bytes. |
|
protected
Since: 4.5.000 (2009-01-02)
|
$numfonts | Counts the number of fonts. |
|
protected
Since: 4.5.000 (2009-01-02)
|
$fontkeys | Store the font keys. |
|
protected
Since: 4.8.001 (2009-09-09)
|
$font_obj_ids | Store the font object IDs. |
|
protected
Since: 4.5.000 (2009-01-02)
|
$pageopen | Store the fage status (true when opened, false when closed). |
|
protected
Since: 4.5.025 (2009-03-10)
|
$default_monospaced_font | Default monospace font. |
|
protected
Since: 4.5.029 (2009-03-19)
|
$objcopy | Cloned copy of the current class object. |
|
protected
Since: 4.5.029 (2009-03-19)
|
$cache_file_length | Array used to store the lengths of cache files. |
|
protected
Since: 4.5.030 (2009-03-20)
|
$thead | Table header content to be repeated on each new page. |
|
protected
Since: 4.5.030 (2009-03-20)
|
$theadMargins | Margins used for table header. |
|
protected
Since: 4.6.005 (2009-04-24)
|
$sign | Boolean flag to enable document digital signature. |
|
protected
Since: 4.6.005 (2009-04-24)
|
$signature_data | Digital signature data. |
|
protected
Since: 4.6.005 (2009-04-24)
|
$signature_max_length | Digital signature max length. |
|
protected
Since: 5.3.011 (2010-06-16)
|
$signature_appearance | Data for digital signature appearance. |
|
protected
Since: 5.9.101 (2011-07-06)
|
$empty_signature_appearance | Array of empty digital signature appearances. |
|
protected
Since: 6.0.085 (2014-06-19)
|
$tsa_timestamp | Boolean flag to enable document timestamping with TSA. |
|
protected
Since: 6.0.085 (2014-06-19)
|
$tsa_data | Timestamping data. |
|
protected
Since: 4.6.006 (2009-04-28)
|
$re_spaces | Regular expression used to find blank characters (required for word-wrapping). |
|
protected
Since: 5.5.011 (2010-07-09)
|
$re_space | Array of $re_spaces parts. |
|
protected
Since: 4.6.022 (2009-06-23)
|
$sig_obj_id | Digital signature object ID. |
|
protected
Since: 4.7.000 (2009-08-29)
|
$page_obj_id | ID of page objects. |
|
protected
Since: 4.8.000 (2009-09-07)
|
$form_obj_id | List of form annotations IDs. |
|
protected
Since: 4.8.000 (2009-09-07)
|
$default_form_prop | Deafult Javascript field properties. Possible values are described on official Javascript for Acrobat API reference. Annotation options can be directly specified using the 'aopt' entry. |
|
protected
Since: 4.8.000 (2009-09-07)
|
$js_objects | Javascript objects array. |
|
protected
Since: 4.8.000 (2009-09-07)
|
$form_action | Current form action (used during XHTML rendering). |
|
protected
Since: 4.8.000 (2009-09-07)
|
$form_enctype | Current form encryption type (used during XHTML rendering). |
|
protected
Since: 4.8.000 (2009-09-07)
|
$form_mode | Current method to submit forms. |
|
protected
Since: 4.8.001 (2009-09-09)
|
$annotation_fonts | List of fonts used on form fields (fontname => fontkey). |
|
protected
Since: 4.8.001 (2009-09-09)
|
$radiobutton_groups | List of radio buttons parent objects. |
|
protected
Since: 4.8.001 (2009-09-09)
|
$radio_groups | List of radio group objects IDs. |
|
protected
Since: 4.8.006 (2009-09-23)
|
$textindent | Text indentation value (used for text-indent CSS attribute). |
|
protected
Since: 4.8.006 (2009-09-23)
|
$start_transaction_page | Store page number when startTransaction() is called. |
|
protected
Since: 4.9.001 (2010-03-28)
|
$start_transaction_y | Store Y position when startTransaction() is called. |
|
protected
Since: 4.8.027 (2010-01-25)
|
$inthead | True when we are printing the thead section on a new page. |
|
protected
Since: 4.9.001 (2010-03-28)
|
$columns | Array of column measures (width, space, starting Y position). |
|
protected
Since: 4.9.001 (2010-03-28)
|
$num_columns | Number of colums. |
|
protected
Since: 4.9.001 (2010-03-28)
|
$current_column | Current column number. |
|
protected
Since: 4.9.001 (2010-03-28)
|
$column_start_page | Starting page for columns. |
|
protected
Since: 5.8.000 (2010-08-11)
|
$maxselcol | Maximum page and column selected. |
|
protected
Since: 5.8.000 (2010-08-11)
|
$colxshift | Array of: X difference between table cell x start and starting page margin, cellspacing, cellpadding. |
|
protected
Since: 4.9.008 (2010-04-03)
|
$textrendermode | Text rendering mode: 0 = Fill text; 1 = Stroke text; 2 = Fill, then stroke text; 3 = Neither fill nor stroke text (invisible); 4 = Fill text and add to path for clipping; 5 = Stroke text and add to path for clipping; 6 = Fill, then stroke text and add to path for clipping; 7 = Add text to path for clipping. |
|
protected
Since: 4.9.008 (2010-04-03)
|
$textstrokewidth | Text stroke width in doc units. |
|
protected
Since: 4.9.008 (2010-04-03)
|
$strokecolor | Current stroke color. |
|
protected
Since: 5.0.000 (2010-04-22)
|
$pdfunit | Default unit of measure for document. |
|
protected | $tocpage | Boolean flag true when we are on TOC (Table Of Content) page. |
|
protected
Since: 5.0.000 (2010-04-26)
|
$rasterize_vector_images | Boolean flag: if true convert vector images (SVG, EPS) to raster image using GD or ImageMagick library. |
|
protected
Since: 5.3.002 (2010-06-07)
|
$font_subsetting | Boolean flag: if true enables font subsetting by default. |
|
protected
Since: 5.5.008 (2010-07-02)
|
$default_graphic_vars | Array of default graphic settings. |
|
protected
Since: 5.8.014 (2010-08-23)
|
$xobjects | Array of XObjects. |
|
protected
Since: 5.8.017 (2010-08-24)
|
$inxobj | Boolean value true when we are inside an XObject. |
|
protected
Since: 5.8.017 (2010-08-24)
|
$xobjid | Current XObject ID. |
|
protected
Since: 5.9.000 (2010-09-29)
|
$font_stretching | Percentage of character stretching. |
|
protected
Since: 5.9.000 (2010-09-29)
|
$font_spacing | Increases or decreases the space between characters in a text by the specified amount (tracking). |
|
protected
Since: 5.9.003 (2010-10-14)
|
$page_regions | Array of no-write regions. |
|
protected | $check_page_regions | Boolean value true when page region check is active. |
|
protected
Since: 5.9.102 (2011-07-13)
|
$pdflayers | Array of PDF layers data. |
|
protected
Since: 5.9.097 (2011-06-23)
|
$dests | A dictionary of names and corresponding destinations (Dests key on document Catalog). |
|
protected
Since: 5.9.097 (2011-06-23)
|
$n_dests | Object ID for Named Destinations |
|
protected
Since: 5.9.204 (2013-01-23)
|
$efnames | Embedded Files Names |
|
protected
Since: 5.0.000 (2010-05-05)
|
$svgdir | Directory used for the last SVG image. |
|
protected
Since: 5.0.000 (2010-05-02)
|
$svgunit | Deafult unit of measure for SVG. |
|
protected
Since: 5.0.000 (2010-05-02)
|
$svggradients | Array of SVG gradients. |
|
protected
Since: 5.0.000 (2010-05-02)
|
$svggradientid | ID of last SVG gradient. |
|
protected
Since: 5.0.000 (2010-05-02)
|
$svgdefsmode | Boolean value true when in SVG defs group. |
|
protected
Since: 5.0.000 (2010-05-02)
|
$svgdefs | Array of SVG defs. |
|
protected
Since: 5.0.000 (2010-04-26)
|
$svgclipmode | Boolean value true when in SVG clipPath tag. |
|
protected
Since: 5.0.000 (2010-05-02)
|
$svgclippaths | Array of SVG clipPath commands. |
|
protected
Since: 5.8.022 (2010-08-31)
|
$svgcliptm | Array of SVG clipPath tranformation matrix. |
|
protected
Since: 5.0.000 (2010-05-02)
|
$svgclipid | ID of last SVG clipPath. |
|
protected
Since: 5.0.000 (2010-05-02)
|
$svgtext | SVG text. |
|
protected
Since: 5.8.013 (2010-08-23)
|
$svgtextmode | SVG text properties. |
|
protected
Since: 5.0.000 (2010-05-02)
|
$svgstyles | Array of SVG properties. |
|
protected
Since: 5.9.121 (2011-09-28)
|
$force_srgb | If true force sRGB color profile for all document. |
|
protected
Since: 5.9.121 (2011-09-27)
|
$pdfa_mode | If true set the document to PDF/A mode. |
|
protected
Since: 6.2.26 (2019-03-12)
|
$pdfa_version | version of PDF/A mode (1 - 3). |
|
protected
Since: 5.9.152 (2012-03-22)
|
$doc_creation_timestamp | Document creation date-time |
|
protected
Since: 5.9.152 (2012-03-22)
|
$doc_modification_timestamp | Document modification date-time |
|
protected
Since: 5.9.128 (2011-10-06)
|
$custom_xmp | Custom XMP data. |
|
protected
Since: 6.3.0 (2019-09-19)
|
$custom_xmp_rdf | Custom XMP RDF data. |
|
protected array<string,bool|int>
Since: 5.9.152 (2012-03-23)
|
$overprint | Overprint mode array. |
|
protected
Since: 5.9.152 (2012-03-23)
|
$alpha | Alpha mode array. |
|
protected
Since: 5.9.152 (2012-03-23)
|
$page_boxes | Define the page boundaries boxes to be set on document. |
|
protected
Since: 5.9.152 (2012-03-23)
|
$tcpdflink | If true print TCPDF meta link. |
|
protected
Since: 5.9.1632 (2012-06-05)
|
$gdgammacache | Cache array for computed GD gamma values. |
|
protected array
Since: 6.3.5 (2020-09-28)
|
$fileContentCache | Cache array for file content |
|
protected bool
Since: 6.4 (2020-07-23)
|
$allowLocalFiles | Whether to allow local file path in image html tags, when prefixed with file:// |
|
static protected | $cleaned_ids |
Methods
This is the class constructor.
Default destructor.
Set the units of measure for the document.
Change the format of the current page
Set page orientation.
Set regular expression to detect withespaces or word separators.
Enable or disable Right-To-Left language mode
Return the RTL status
Force temporary RTL language direction
Return the current temporary RTL status
Set the last cell height.
Return the cell height
Reset the last cell height.
Get the last cell height.
Set the adjusting factor to convert pixels to user units.
Returns the adjusting factor to convert pixels to user units.
Returns an array of page dimensions:
- $this->pagedim[$this->page]['w'] = page width in points
- $this->pagedim[$this->page]['h'] = height in points
- $this->pagedim[$this->page]['wk'] = page width in user units
- $this->pagedim[$this->page]['hk'] = page height in user units
- $this->pagedim[$this->page]['tm'] = top margin
- $this->pagedim[$this->page]['bm'] = bottom margin
- $this->pagedim[$this->page]['lm'] = left margin
- $this->pagedim[$this->page]['rm'] = right margin
- $this->pagedim[$this->page]['pb'] = auto page break
- $this->pagedim[$this->page]['or'] = page orientation
- $this->pagedim[$this->page]['olm'] = original left margin
- $this->pagedim[$this->page]['orm'] = original right margin
- $this->pagedim[$this->page]['Rotate'] = The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
- $this->pagedim[$this->page]['PZ'] = The page's preferred zoom (magnification) factor.
- $this->pagedim[$this->page]['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
- $this->pagedim[$this->page]['trans']['Dur'] = The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
- $this->pagedim[$this->page]['trans']['S'] = transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
- $this->pagedim[$this->page]['trans']['D'] = The duration of the transition effect, in seconds.
- $this->pagedim[$this->page]['trans']['Dm'] = (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
- $this->pagedim[$this->page]['trans']['M'] = (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
- $this->pagedim[$this->page]['trans']['Di'] = (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
- $this->pagedim[$this->page]['trans']['SS'] = (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
- $this->pagedim[$this->page]['trans']['B'] = (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
- $this->pagedim[$this->page]['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed
- $this->pagedim[$this->page]['MediaBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['MediaBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['MediaBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['MediaBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['CropBox'] : the visible region of default user space
- $this->pagedim[$this->page]['CropBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['CropBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['CropBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['CropBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment
- $this->pagedim[$this->page]['BleedBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['BleedBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['BleedBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['BleedBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['TrimBox'] : the intended dimensions of the finished page after trimming
- $this->pagedim[$this->page]['TrimBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['TrimBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['TrimBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['TrimBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['ArtBox'] : the extent of the page's meaningful content
- $this->pagedim[$this->page]['ArtBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['ArtBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['ArtBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['ArtBox']['ury'] = upper-right y coordinate in points
Returns the page width in units.
Returns the page height in units.
Returns the page break margin.
Returns the scale factor (number of points in user unit).
Defines the left, top and right margins.
Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.
Defines the top margin. The method can be called before creating the first page.
Defines the right margin. The method can be called before creating the first page.
Set the same internal Cell padding for top, right, bottom, left-
Set the internal Cell paddings.
Get the internal Cell padding array.
Set the internal Cell margins.
Get the internal Cell margin array.
Adjust the internal Cell padding array to take account of the line width.
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.
Return the auto-page-break mode (true or false).
Defines the way the document is to be displayed by the viewer.
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.
Set flag to force sRGB_IEC61966-2.1 black scaled ICC color profile for the whole document.
Turn on/off Unicode mode for document information dictionary (meta tags).
Defines the title of the document.
Defines the subject of the document.
Defines the author of the document.
Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
Defines the creator of the document. This is typically the name of the application that generates the PDF.
Whether to allow local file path in image html tags, when prefixed with file://
Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.
This method begins the generation of the PDF document.
Terminates the PDF document.
Move pointer at the specified document page and update page dimensions.
Reset pointer to the last document page.
Get current document page number.
Get the total number of insered pages.
Adds a new TOC (Table Of Content) page to the document.
Terminate the current TOC (Table Of Content) page
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).
Terminate the current page
Starts a new page to the document. The page must be closed using the endPage() function.
Set start-writing mark on current page stream used to put borders and fills.
Set start-writing mark on selected page.
Set header data.
Set footer data.
Returns header data:
- $ret['logo'] = logo image
- $ret['logo_width'] = width of the image logo in user units
- $ret['title'] = header title
- $ret['string'] = header description string
Set header margin.
Returns header margin in user units.
Set footer margin.
Returns footer margin in user units.
Set a flag to print page header.
Set a flag to print page footer.
Return the right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image
Return the right-bottom (or left-bottom for RTL) corner Y coordinate of last inserted image
Reset the xobject template used by Header() method.
Set a flag to automatically reset the xobject template used by Header() method at each page.
This method is used to render the page header.
This method is used to render the page footer.
This method is used to render the page header.
This method is used to render the page footer.
Check if we are on the page body (excluding page header and footer).
This method is used to render the table header on new page (if any).
Returns the current page number.
Returns the array of spot colors.
Defines a new spot color.
Set the spot color for the specified type ('draw', 'fill', 'text').
Defines the spot color used for all drawing operations (lines, rectangles and cell borders).
Defines the spot color used for all filling operations (filled rectangles and cell backgrounds).
Defines the spot color used for text.
Set the color array for the specified type ('draw', 'fill', 'text').
Defines the color used for all drawing operations (lines, rectangles and cell borders).
Defines the color used for all filling operations (filled rectangles and cell backgrounds).
Defines the color used for text. It can be expressed in RGB components or gray scale.
Defines the color used by the specified type ('draw', 'fill', 'text').
Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Defines the color used for 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.
Returns the length of a string in user unit. A font must be selected.
Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.
Returns the length of the char in user unit for the current font considering current stretching and spacing (tracking).
Returns the length of the char in user unit for the current font.
Returns the numbero of characters in a string.
Fill the list of available fonts ($this->fontlist).
Imports a TrueType, Type1, core, or CID0 font and makes it available.
Sets the font used to print character strings.
Defines the size of the current font.
Returns the bounding box of the current font in user units.
Convert a relative font measure into absolute value.
Returns the glyph bounding box of the specified character in the current font in user units.
Return the font descent value
Return the font ascent value.
Return true in the character is present in the specified font.
Replace missing font characters on selected font with specified substitutions.
Defines the default monospaced font.
Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document.
The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().
Defines the page and position a link points to.
Puts a link on a rectangular area of the page.
Puts a markup annotation on a rectangular area of the page.
Embedd the attached files.
Prints a text cell at the specified position.
Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value.
Add page if needed.
Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
Returns the PDF string code to print a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
Replace a char if is defined on the current font.
Returns the code to draw the cell border
This method allows printing text with line breaks.
This method return the estimated number of lines for print a simple text string using Multicell() method.
This method return the estimated height needed for printing a simple text string using the Multicell() method.
This method prints text from the current position.
Returns the remaining width between the current position and margins.
Set the block dimensions accounting for page breaks and page/column fitting
Puts an image in the page.
Extract info from a PNG image with alpha channel using the Imagick or GD library.
Get the GD-corrected PNG gamma value from alpha color
Performs a line break.
Returns the relative X value of current position.
Returns the absolute X value of current position.
Returns the ordinate of the current position.
Defines the abscissa of the current position.
Moves the current abscissa back to the left margin and sets the ordinate.
Defines the abscissa and ordinate of the current position.
Set the absolute X coordinate of the current pointer.
Set the absolute Y coordinate of the current pointer.
Set the absolute X and Y coordinates of the current pointer.
Send the document to a given destination: string, local file or browser.
Unset all class variables except the following critical variables.
Check for locale-related bug
Return an array containing variations for the basic page number alias.
Return an array containing all internal page aliases.
Replace right shift page number aliases with spaces to correct right alignment.
Set page boxes to be included on page descriptions.
Output pages (and replace page number aliases).
Get references to page annotations.
Output annotations objects for all pages.
Put appearance streams XObject used to define annotation's appearance states.
Output fonts.
Adds unicode fonts.
Based on PDF Reference 1.3 (section 5)
Output CID-0 fonts.
Output images.
Output Form XObjects Templates.
Output Spot Colors Resources.
Return XObjects Dictionary.
Output Resources Dictionary.
Output Resources.
Adds some Metadata information (Document Information Dictionary) (see Chapter 14.3.3 Document Information Dictionary of PDF32000_2008.pdf Reference)
Set additional XMP data to be added on the default XMP data just before the end of "x:xmpmeta" tag.
Set additional XMP data to be added on the default XMP data just before the end of "rdf:RDF" tag.
Put XMP data object and return ID.
Output Catalog.
Output viewer preferences.
Output PDF File Header (7.5.2).
Output end of document (EOF).
Initialize a new page.
Mark end of page.
Begin a new object and return the object number.
Return the starting object string for the selected object ID.
Underline text.
Underline for rectangular text area.
Line through text.
Line through for rectangular text area.
Overline text.
Overline for rectangular text area.
Format a data string for meta information
Set the document creation timestamp
Set the document modification timestamp
Returns document creation timestamp in seconds.
Returns document modification timestamp in seconds.
Returns a formatted date for meta information
Format a text string for meta information
get raw output stream.
Output a string to the document.
Set header font.
Get header font.
Set footer font.
Get Footer font.
Set language array.
Returns the PDF data.
Output anchor link.
Converts pixels to User's Units.
Reverse function for htmlentities.
Compute encryption key depending on object number where the encrypted data is stored.
Encrypt the input string.
Put encryption on PDF document.
Compute U value (used for encryption)
Compute UE value (used for encryption)
Compute O value (used for encryption)
Compute OE value (used for encryption)
Convert password for AES-256 encryption mode
Compute encryption key
Set document protection Remark: the protection against modification is for people who have the full Acrobat product.
Starts a 2D tranformation saving current graphic state.
Stops a 2D tranformation restoring previous graphic state.
Horizontal Scaling.
Vertical Scaling.
Vertical and horizontal proportional Scaling.
Vertical and horizontal non-proportional Scaling.
Horizontal Mirroring.
Verical Mirroring.
Point reflection mirroring.
Reflection against a straight line through point (x, y) with the gradient angle (angle).
Translate graphic object horizontally.
Translate graphic object vertically.
Translate graphic object horizontally and vertically.
Rotate object.
Skew horizontally.
Skew vertically.
Skew.
Apply graphic transformations.
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.
Returns the current the line width.
Set line style.
Begin a new subpath by moving the current point to coordinates (x, y), omitting any connecting line segment.
Append a straight line segment from the current point to the point (x, y).
Append a rectangle to the current path as a complete subpath, with lower-left corner (x, y) and dimensions widthand height in user space.
Append a 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.
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.
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.
Draws a line between two points.
Draws a rectangle.
Draws a Bezier curve.
Draws a poly-Bezier curve.
Draws an ellipse.
Append an elliptical arc to the current path.
Draws a circle.
Draws a polygonal line
Draws a polygon.
Draws a regular polygon.
Draws a star polygon
Draws a rounded rectangle.
Draws a rounded rectangle.
Draws a grahic arrow.
Add a Named Destination.
Return the Named Destination array.
Insert Named Destinations.
Adds a bookmark - alias for Bookmark().
Adds a bookmark.
Sort bookmarks for page and key.
Create a bookmark PDF string.
Adds a javascript
Adds a javascript object and return object ID
Create a javascript PDF string.
Adds a javascript form field.
Set default properties for form fields.
Return the default properties for form fields.
Creates a text field
Creates a RadioButton field.
Creates a List-box field
Creates a Combo-box field
Creates a CheckBox field
Creates a button field
Add certification signature (DocMDP or UR3) You can set only one signature type
Set User's Rights for PDF Reader WARNING: This is experimental and currently do not work.
Enable document signature (requires the OpenSSL Library).
Set the digital signature appearance (a cliccable rectangle area to get signature properties)
Add an empty digital signature appearance (a cliccable rectangle area to get signature properties)
Get the array that defines the signature appearance (page and rectangle coordinates).
Enable document timestamping (requires the OpenSSL Library).
NOT YET IMPLEMENTED Request TSA for a timestamp
Create a new page group.
Set the starting page number.
Returns the string alias used right align page numbers.
Returns the string alias used for the total number of pages.
Returns the string alias used for the page number.
Return the alias for the total number of pages in the current page group.
Return the alias for the page number on the current page group.
Return the current page in the group.
Returns the current group page number formatted as a string.
Returns the current page number formatted as a string.
Put pdf layers.
Start a new pdf layer.
End the current PDF layer.
Set the visibility of the successive elements.
Add transparency parameters to the current extgstate
Add an extgstate
Put extgstates for object transparency
Set overprint mode for stroking (OP) and non-stroking (op) painting operations.
Get the overprint mode array (OP, op, OPM).
Set alpha for stroking (CA) and non-stroking (ca) operations.
Get the alpha mode array (CA, ca, BM, AIS).
Set the default JPEG compression quality (1-100)
Set the default number of columns in a row for HTML tables.
Set the height of the cell (line height) respect the font height.
return the height of cell repect font height.
Set the PDF version (check PDF reference for valid values).
Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.
Paints color transition registration bars
Paints crop marks.
Paints a registration mark
Paints a CMYK registration mark
Paints a linear colour gradient.
Paints a radial colour gradient.
Paints a coons patch mesh.
Set a rectangular clipping area.
Output gradient.
Output gradient shaders.
Draw the sector of a circle.
Draw the sector of an ellipse.
Embed vector-based Adobe Illustrator (AI) or AI-compatible EPS files.
Set document barcode.
Get current barcode.
Print a Linear Barcode.
Print 2D Barcode.
Returns an array containing current margins:
- $ret['left'] = left margin
- $ret['right'] = right margin
- $ret['top'] = top margin
- $ret['bottom'] = bottom margin
- $ret['header'] = header margin
- $ret['footer'] = footer margin
- $ret['cell'] = cell padding array
- $ret['padding_left'] = cell left padding
- $ret['padding_top'] = cell top padding
- $ret['padding_right'] = cell right padding
- $ret['padding_bottom'] = cell bottom padding
Returns an array containing original margins:
- $ret['left'] = left margin
- $ret['right'] = right margin
Returns the current font size.
Returns the current font size in points unit.
Returns the current font family name.
Returns the current font style.
Cleanup HTML code (requires HTML Tidy library).
Returns the border width from CSS property
Returns the border dash style from CSS property
Returns the border style array from CSS border properties
Get the internal Cell padding from CSS attribute.
Get the internal Cell margin from CSS attribute.
Get the border-spacing from CSS attribute.
Returns the letter-spacing value from CSS value
Returns the percentage of font stretching from CSS value
Convert HTML string containing font size value to points
Returns the HTML DOM array.
Returns the string used to find spaces
Calculates the hash value of the given data.
Serialize data to be used with TCPDF tag in HTML code.
Unserialize data to be used with TCPDF tag in HTML code.
Check if a TCPDF tag is allowed
Prints a cell (rectangular area) with optional borders, background color and html text string.
Allows to preserve some HTML formatting (limited support).
IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting.
Process opening tags.
Process closing tags.
Add vertical spaces if needed.
Return the starting coordinates to draw an html border
Draw an HTML block border and fill
Set the default bullet to be used as LI bullet symbol
Set the booklet mode for double-sided pages.
Swap the left and right margins.
Set the vertical spaces for HTML tags.
Set custom width for list indentation.
Set the top/bottom cell sides to be open or closed when the cell cross the page.
Set the color and font style for HTML links.
Convert HTML string containing value and unit of measure to user's units or points.
Output an HTML list bullet or ordered item symbol
Returns current graphic variables as array.
Set graphic variables.
Outputs the "save graphics state" operator 'q'
Outputs the "restore graphics state" operator 'Q'
Set buffer content (always append data).
Replace the buffer content
Get buffer content.
Set page buffer content.
Get page buffer content.
Set image buffer content.
Set image buffer content for a specified sub-key.
Get image buffer content.
Set font buffer content.
Set font buffer content.
Get font buffer content.
Move a page to a previous position.
Remove the specified page.
Clone the specified page to a new page.
Output a Table of Content Index (TOC).
Output a Table Of Content Index (TOC) using HTML templates.
Stores a copy of the current TCPDF object used for undo operation.
Delete the copy of the current TCPDF object used for undo operation.
This method allows to undo the latest transaction by returning the latest saved TCPDF object with startTransaction().
Set multiple columns of the same size
Remove columns and reset page margins.
Set columns array.
Set position at a given column
Return the current column number
Return the current number of columns.
Set Text rendering mode.
Set parameters for drop shadow effect for text.
Return the text shadow parameters array.
Returns an array of chars containing soft hyphens.
Returns text with soft hyphens.
Enable/disable rasterization of vector images using ImageMagick library.
Enable or disable default option for font subsetting.
Return the default option for font subsetting.
Left trim the input string
Right trim the input string
Trim the input string
Return true if the current font is unicode type.
Return normalized font name
Start a new XObject Template.
End the current XObject Template started with startTemplate() and restore the previous graphic state.
Print an XObject Template.
Set the percentage of character stretching.
Get the percentage of character stretching.
Set the amount to increase or decrease the space between characters in a text.
Get the amount to increase or decrease the space between characters in a text.
Return an array of no-write page regions
Set no-write regions on page.
Add a single no-write region on selected page.
Remove a single no-write region.
Check page for no-write regions and adapt current coordinates and page margins if necessary.
Embedd a Scalable Vector Graphics (SVG) image.
Convert SVG transformation matrix to PDF.
Apply SVG graphic transformation matrix.
Apply the requested SVG styles ( TO BE COMPLETED )
Draws an SVG path
Return the tag name without the namespace
Sets the opening SVG element handler function for the XML parser. ( TO BE COMPLETED )
Sets the closing SVG element handler function for the XML parser.
Sets the character data handler function for the XML parser.
Keeps files in memory, so it doesn't need to downloaded everytime in a loop
Avoid multiple calls to an external server to see if a file exists
Details
__construct(string $orientation = 'P', string $unit = 'mm', mixed $format = 'A4', bool $unicode = true, string $encoding = 'UTF-8', bool $diskcache = false, false|int $pdfa = false)
This is the class constructor.
It allows to set up the page format, the orientation and the measure unit used in all the methods (except for the font sizes).
__destruct()
Default destructor.
setPageUnit(string $unit)
Set the units of measure for the document.
protected
setPageFormat(mixed $format, string $orientation = 'P')
Change the format of the current page
setPageOrientation(string $orientation, bool|null $autopagebreak = null, float|null $bottommargin = null)
Set page orientation.
setSpacesRE(string $re = '/[^\\S\\xa0]/')
Set regular expression to detect withespaces or word separators.
The pattern delimiter must be the forward-slash character "/". Some example patterns are:
Non-Unicode or missing PCRE unicode support: "/[^\S\xa0]/" Unicode and PCRE unicode support: "/(?!\xa0)[\s\p{Z}]/u" Unicode and PCRE unicode support in Chinese mode: "/(?!\xa0)[\s\p{Z}\p{Lo}]/u" if PCRE unicode support is turned ON ("\P" is the negate class of "\p"): \s : any whitespace character \p{Z} : any separator \p{Lo} : Unicode letter or ideograph that does not have lowercase and uppercase variants. Is used to chunk chinese words. \xa0 : Unicode Character 'NO-BREAK SPACE' (U+00A0)
setRTL(bool $enable, bool $resetx = true)
Enable or disable Right-To-Left language mode
bool
getRTL()
Return the RTL status
setTempRTL(false|string $mode)
Force temporary RTL language direction
bool
isRTLTextDir()
Return the current temporary RTL status
setLastH(float $h)
Set the last cell height.
float
getCellHeight(int $fontsize, bool $padding = TRUE)
Return the cell height
resetLastH()
Reset the last cell height.
float
getLastH()
Get the last cell height.
setImageScale(float $scale)
Set the adjusting factor to convert pixels to user units.
float
getImageScale()
Returns the adjusting factor to convert pixels to user units.
array
getPageDimensions(int|null $pagenum = null)
Returns an array of page dimensions:
- $this->pagedim[$this->page]['w'] = page width in points
- $this->pagedim[$this->page]['h'] = height in points
- $this->pagedim[$this->page]['wk'] = page width in user units
- $this->pagedim[$this->page]['hk'] = page height in user units
- $this->pagedim[$this->page]['tm'] = top margin
- $this->pagedim[$this->page]['bm'] = bottom margin
- $this->pagedim[$this->page]['lm'] = left margin
- $this->pagedim[$this->page]['rm'] = right margin
- $this->pagedim[$this->page]['pb'] = auto page break
- $this->pagedim[$this->page]['or'] = page orientation
- $this->pagedim[$this->page]['olm'] = original left margin
- $this->pagedim[$this->page]['orm'] = original right margin
- $this->pagedim[$this->page]['Rotate'] = The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
- $this->pagedim[$this->page]['PZ'] = The page's preferred zoom (magnification) factor.
- $this->pagedim[$this->page]['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
- $this->pagedim[$this->page]['trans']['Dur'] = The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
- $this->pagedim[$this->page]['trans']['S'] = transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
- $this->pagedim[$this->page]['trans']['D'] = The duration of the transition effect, in seconds.
- $this->pagedim[$this->page]['trans']['Dm'] = (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
- $this->pagedim[$this->page]['trans']['M'] = (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
- $this->pagedim[$this->page]['trans']['Di'] = (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
- $this->pagedim[$this->page]['trans']['SS'] = (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
- $this->pagedim[$this->page]['trans']['B'] = (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
- $this->pagedim[$this->page]['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed
- $this->pagedim[$this->page]['MediaBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['MediaBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['MediaBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['MediaBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['CropBox'] : the visible region of default user space
- $this->pagedim[$this->page]['CropBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['CropBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['CropBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['CropBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment
- $this->pagedim[$this->page]['BleedBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['BleedBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['BleedBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['BleedBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['TrimBox'] : the intended dimensions of the finished page after trimming
- $this->pagedim[$this->page]['TrimBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['TrimBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['TrimBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['TrimBox']['ury'] = upper-right y coordinate in points
- $this->pagedim[$this->page]['ArtBox'] : the extent of the page's meaningful content
- $this->pagedim[$this->page]['ArtBox']['llx'] = lower-left x coordinate in points
- $this->pagedim[$this->page]['ArtBox']['lly'] = lower-left y coordinate in points
- $this->pagedim[$this->page]['ArtBox']['urx'] = upper-right x coordinate in points
- $this->pagedim[$this->page]['ArtBox']['ury'] = upper-right y coordinate in points
int|float
getPageWidth(int|null $pagenum = null)
Returns the page width in units.
int|float
getPageHeight(int|null $pagenum = null)
Returns the page height in units.
int|float
getBreakMargin(int|null $pagenum = null)
Returns the page break margin.
int
getScaleFactor()
Returns the scale factor (number of points in user unit).
setMargins(int|float $left, int|float $top, int|float|null $right = null, bool $keepmargins = false)
Defines the left, top and right margins.
setLeftMargin(int|float $margin)
Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.
setTopMargin(int|float $margin)
Defines the top margin. The method can be called before creating the first page.
setRightMargin(int|float $margin)
Defines the right margin. The method can be called before creating the first page.
setCellPadding(int|float $pad)
Set the same internal Cell padding for top, right, bottom, left-
setCellPaddings(int|float|null $left = null, int|float|null $top = null, int|float|null $right = null, int|float|null $bottom = null)
Set the internal Cell paddings.
array
getCellPaddings()
Get the internal Cell padding array.
setCellMargins(int|float|null $left = null, int|float|null $top = null, int|float|null $right = null, int|float|null $bottom = null)
Set the internal Cell margins.
array
getCellMargins()
Get the internal Cell margin array.
protected void|array
adjustCellPadding(string|array|int|bool $brd = 0)
Adjust the internal Cell padding array to take account of the line width.
setAutoPageBreak(bool $auto, float $margin = 0)
Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.
bool
getAutoPageBreak()
Return the auto-page-break mode (true or false).
setDisplayMode(mixed $zoom, string $layout = 'SinglePage', string $mode = 'UseNone')
Defines the way the document is to be displayed by the viewer.
setCompression(bool $compress = true)
Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default.
Note: the Zlib extension is required for this feature. If not present, compression will be turned off.
setSRGBmode(bool $mode = false)
Set flag to force sRGB_IEC61966-2.1 black scaled ICC color profile for the whole document.
setDocInfoUnicode(bool $unicode = true)
Turn on/off Unicode mode for document information dictionary (meta tags).
This has effect only when unicode mode is set to false.
setTitle(string $title)
Defines the title of the document.
setSubject(string $subject)
Defines the subject of the document.
setAuthor(string $author)
Defines the author of the document.
setKeywords(string $keywords)
Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
setCreator(string $creator)
Defines the creator of the document. This is typically the name of the application that generates the PDF.
setAllowLocalFiles(bool $allowLocalFiles)
Whether to allow local file path in image html tags, when prefixed with file://
Error(string $msg)
Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.
Open()
This method begins the generation of the PDF document.
It is not necessary to call it explicitly because AddPage() does it automatically. Note: no page is created by this method
Close()
Terminates the PDF document.
It is not necessary to call this method explicitly because Output() does it automatically. If the document contains no page, AddPage() is called to prevent from getting an invalid document.
setPage(int $pnum, bool $resetmargins = false)
Move pointer at the specified document page and update page dimensions.
lastPage(bool $resetmargins = false)
Reset pointer to the last document page.
int
getPage()
Get current document page number.
int
getNumPages()
Get the total number of insered pages.
addTOCPage(string $orientation = '', mixed $format = '', bool $keepmargins = false)
Adds a new TOC (Table Of Content) page to the document.
endTOCPage()
Terminate the current TOC (Table Of Content) page
AddPage(string $orientation = '', mixed $format = '', bool $keepmargins = false, bool $tocpage = false)
Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer (if enabled). Then the page is added, the current position set to the top-left corner according to the left and top margins (or top-right if in RTL mode), and Header() is called to display the header (if enabled).
The origin of the coordinate system is at the top-left corner (or top-right for RTL) and increasing ordinates go downwards.
endPage(bool $tocpage = false)
Terminate the current page
startPage(string $orientation = '', mixed $format = '', bool $tocpage = false)
Starts a new page to the document. The page must be closed using the endPage() function.
The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards.
setPageMark()
Set start-writing mark on current page stream used to put borders and fills.
Borders and fills are always created after content and inserted on the position marked by this method. This function must be called after calling Image() function for a background image. Background images must be always inserted before calling Multicell() or WriteHTMLCell() or WriteHTML() functions.
protected
setContentMark(int $page = 0)
Set start-writing mark on selected page.
Borders and fills are always created after content and inserted on the position marked by this method.
setHeaderData(string $ln = '', int $lw = 0, string $ht = '', string $hs = '', int[] $tc = array(0, 0, 0), int[] $lc = array(0, 0, 0))
Set header data.
setFooterData(int[] $tc = array(0, 0, 0), int[] $lc = array(0, 0, 0))
Set footer data.
array<string,mixed>
getHeaderData()
Returns header data:
- $ret['logo'] = logo image
- $ret['logo_width'] = width of the image logo in user units
- $ret['title'] = header title
- $ret['string'] = header description string
setHeaderMargin(float $hm = 10)
Set header margin.
(minimum distance between header and top page margin)
float
getHeaderMargin()
Returns header margin in user units.
setFooterMargin(float $fm = 10)
Set footer margin.
(minimum distance between footer and bottom page margin)
float
getFooterMargin()
Returns footer margin in user units.
setPrintHeader(bool $val = true)
Set a flag to print page header.
setPrintFooter(bool $val = true)
Set a flag to print page footer.
float
getImageRBX()
Return the right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image
float
getImageRBY()
Return the right-bottom (or left-bottom for RTL) corner Y coordinate of last inserted image
resetHeaderTemplate()
Reset the xobject template used by Header() method.
setHeaderTemplateAutoreset(bool $val = true)
Set a flag to automatically reset the xobject template used by Header() method at each page.
Header()
This method is used to render the page header.
It is automatically called by AddPage() and could be overwritten in your own inherited class.
Footer()
This method is used to render the page footer.
It is automatically called by AddPage() and could be overwritten in your own inherited class.
protected
setHeader()
This method is used to render the page header.
protected
setFooter()
This method is used to render the page footer.
protected bool
inPageBody()
Check if we are on the page body (excluding page header and footer).
protected
setTableHeader()
This method is used to render the table header on new page (if any).
int
PageNo()
Returns the current page number.
array
getAllSpotColors()
Returns the array of spot colors.
AddSpotColor(string $name, float $c, float $m, float $y, float $k)
Defines a new spot color.
It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
string
setSpotColor(string $type, string $name, float $tint = 100)
Set the spot color for the specified type ('draw', 'fill', 'text').
setDrawSpotColor(string $name, float $tint = 100)
Defines the spot color used for all drawing operations (lines, rectangles and cell borders).
setFillSpotColor(string $name, float $tint = 100)
Defines the spot color used for all filling operations (filled rectangles and cell backgrounds).
setTextSpotColor(string $name, int $tint = 100)
Defines the spot color used for text.
string
setColorArray(string $type, array $color, bool $ret = false)
Set the color array for the specified type ('draw', 'fill', 'text').
It can be expressed in RGB, CMYK or GRAY SCALE components. The method can be called before the first page is created and the value is retained from page to page.
string
setDrawColorArray(array $color, bool $ret = false)
Defines the color used for all drawing operations (lines, rectangles and cell borders).
It can be expressed in RGB, CMYK or GRAY SCALE components. The method can be called before the first page is created and the value is retained from page to page.
setFillColorArray(array $color, bool $ret = false)
Defines the color used for all filling operations (filled rectangles and cell backgrounds).
It can be expressed in RGB, CMYK or GRAY SCALE components. The method can be called before the first page is created and the value is retained from page to page.
setTextColorArray(array $color, bool $ret = false)
Defines the color used for text. It can be expressed in RGB components or gray scale.
The method can be called before the first page is created and the value is retained from page to page.
string
setColor(string $type, float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $name = '')
Defines the color used by the specified type ('draw', 'fill', 'text').
string
setDrawColor(float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $name = '')
Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
string
setFillColor(float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $name = '')
Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
string
setTextColor(float $col1 = 0, float $col2 = -1, float $col3 = -1, float $col4 = -1, bool $ret = false, string $name = '')
Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
float[]|float
GetStringWidth(string $s, string $fontname = '', string $fontstyle = '', float $fontsize = 0, bool $getarray = false)
Returns the length of a string in user unit. A font must be selected.
float[]|float
GetArrStringWidth(array $sa, string $fontname = '', string $fontstyle = '', float $fontsize = 0, bool $getarray = false)
Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.
float
GetCharWidth(int $char, bool $notlast = true)
Returns the length of the char in user unit for the current font considering current stretching and spacing (tracking).
float
getRawCharWidth(int $char)
Returns the length of the char in user unit for the current font.
int
GetNumChars(string $s)
Returns the numbero of characters in a string.
protected
getFontsList()
Fill the list of available fonts ($this->fontlist).
array|false
AddFont(string $family, string $style = '', string $fontfile = '', mixed $subset = 'default')
Imports a TrueType, Type1, core, or CID0 font and makes it available.
It is necessary to generate a font definition file first (read /fonts/utils/README.TXT). The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by K_PATH_FONTS if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.
setFont(string $family, string $style = '', float|null $size = null, string $fontfile = '', mixed $subset = 'default', bool $out = true)
Sets the font used to print character strings.
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
setFontSize(float $size, bool $out = true)
Defines the size of the current font.
array
getFontBBox()
Returns the bounding box of the current font in user units.
float
getAbsFontMeasure(int $s)
Convert a relative font measure into absolute value.
false|array
getCharBBox(int $char)
Returns the glyph bounding box of the specified character in the current font in user units.
int
getFontDescent(string $font, string $style = '', float $size = 0)
Return the font descent value
int
getFontAscent(string $font, string $style = '', float $size = 0)
Return the font ascent value.
bool
isCharDefined(mixed $char, string $font = '', string $style = '')
Return true in the character is present in the specified font.
string
replaceMissingChars(string $text, string $font = '', string $style = '', array $subs = array())
Replace missing font characters on selected font with specified substitutions.
setDefaultMonospacedFont(string $font)
Defines the default monospaced font.
AddLink()
Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document.
The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink().
setLink(int $link, float $y = 0, int|string $page = -1)
Defines the page and position a link points to.
Link(float $x, float $y, float $w, float $h, mixed $link, int $spaces = 0)
Puts a link on a rectangular area of the page.
Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image.
Annotation(float $x, float $y, float $w, float $h, string $text, array $opt = array('Subtype' => 'Text'), int $spaces = 0)
Puts a markup annotation on a rectangular area of the page.
!!!!THE ANNOTATION SUPPORT IS NOT YET FULLY IMPLEMENTED !!!!
protected
_putEmbeddedFiles()
Embedd the attached files.
Text(float $x, float $y, string $txt, int $fstroke = 0, bool $fclip = false, bool $ffill = true, mixed $border = 0, int $ln = 0, string $align = '', bool $fill = false, mixed $link = '', int $stretch = 0, bool $ignore_min_height = false, string $calign = 'T', string $valign = 'M', bool $rtloff = false)
Prints a text cell at the specified position.
This method allows to place a string precisely on the page.
bool
AcceptPageBreak()
Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value.
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.
protected bool
checkPageBreak(float $h = 0, float|null $y = null, bool $addpage = true)
Add page if needed.
Cell(float $w, float $h = 0, string $txt = '', mixed $border = 0, int $ln = 0, string $align = '', bool $fill = false, mixed $link = '', int $stretch = 0, bool $ignore_min_height = false, string $calign = 'T', string $valign = 'M')
Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
protected string
getCellCode(float $w, float $h = 0, string $txt = '', mixed $border = 0, int $ln = 0, string $align = '', bool $fill = false, mixed $link = '', int $stretch = 0, bool $ignore_min_height = false, string $calign = 'T', string $valign = 'M')
Returns the PDF string code to print a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
protected int
replaceChar(int $oldchar, int $newchar)
Replace a char if is defined on the current font.
protected string
getCellBorder(float $x, float $y, float $w, float $h, string|array|int $brd)
Returns the code to draw the cell border
int
MultiCell(float $w, float $h, string $txt, mixed $border = 0, string $align = 'J', bool $fill = false, int $ln = 1, float|null $x = null, float|null $y = null, bool $reseth = true, int $stretch = 0, bool $ishtml = false, bool $autopadding = true, float $maxh = 0, string $valign = 'T', bool $fitcell = false)
This method allows printing text with line breaks.
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.
float
getNumLines(string $txt, float $w = 0, bool $reseth = false, bool $autopadding = true, array|null $cellpadding = null, mixed $border = 0)
This method return the estimated number of lines for print a simple text string using Multicell() method.
float
getStringHeight(float $w, string $txt, bool $reseth = false, bool $autopadding = true, array|null $cellpadding = null, mixed $border = 0)
This method return the estimated height needed for printing a simple text string using the Multicell() method.
Generally, if you want to know the exact height for a block of content you can use the following alternative technique:
mixed
Write(float $h, string $txt, mixed $link = '', bool $fill = false, string $align = '', bool $ln = false, int $stretch = 0, bool $firstline = false, bool $firstblock = false, float $maxh = 0, float $wadj = 0, array|null $margin = null)
This method prints text from the current position.
protected float
getRemainingWidth()
Returns the remaining width between the current position and margins.
protected array
fitBlock(float $w, float $h, float $x, float $y, bool $fitonpage = false)
Set the block dimensions accounting for page breaks and page/column fitting
mixed|false
Image(string $file, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, string $type = '', mixed $link = '', string $align = '', mixed $resize = false, int $dpi = 300, string $palign = '', bool $ismask = false, mixed $imgmask = false, mixed $border = 0, mixed $fitbox = false, bool $hidden = false, bool $fitonpage = false, bool $alt = false, array $altimgs = array())
Puts an image in the page.
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
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.
protected
ImagePngAlpha(string $file, float $x, float $y, float $wpx, float $hpx, float $w, float $h, string $type, mixed $link, string $align, bool $resize, int $dpi, string $palign, string $filehash = '')
Extract info from a PNG image with alpha channel using the Imagick or GD library.
protected
getGDgamma(resource $img, int $c)
Get the GD-corrected PNG gamma value from alpha color
Ln(float|null $h = null, bool $cell = false)
Performs a line break.
The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter.
float
GetX()
Returns the relative X value of current position.
The value is relative to the left border for LTR languages and to the right border for RTL languages.
float
GetAbsX()
Returns the absolute X value of current position.
float
GetY()
Returns the ordinate of the current position.
setX(float $x, bool $rtloff = false)
Defines the abscissa of the current position.
If the passed value is negative, it is relative to the right of the page (or left if language is RTL).
setY(float $y, bool $resetx = true, bool $rtloff = false)
Moves the current abscissa back to the left margin and sets the ordinate.
If the passed value is negative, it is relative to the bottom of the page.
setXY(float $x, float $y, bool $rtloff = false)
Defines the abscissa and ordinate of the current position.
If the passed values are negative, they are relative respectively to the right and bottom of the page.
setAbsX(float $x)
Set the absolute X coordinate of the current pointer.
setAbsY(float $y)
Set the absolute Y coordinate of the current pointer.
setAbsXY(float $x, float $y)
Set the absolute X and Y coordinates of the current pointer.
string
Output(string $name = 'doc.pdf', string $dest = 'I')
Send the document to a given destination: string, local file or browser.
In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.
The method first calls Close() if necessary to terminate the document.
_destroy(bool $destroyall = false, bool $preserve_objcopy = false)
Unset all class variables except the following critical variables.
protected
_dochecks()
Check for locale-related bug
protected array
getInternalPageNumberAliases(string $a = '')
Return an array containing variations for the basic page number alias.
protected array
getAllInternalPageNumberAliases()
Return an array containing all internal page aliases.
protected string
replaceRightShiftPageNumAliases(string $page, array $aliases, int $diff)
Replace right shift page number aliases with spaces to correct right alignment.
This works perfectly only when using monospaced fonts.
protected
setPageBoxTypes(array $boxes)
Set page boxes to be included on page descriptions.
protected
_putpages()
Output pages (and replace page number aliases).
protected string
_getannotsrefs(int $n)
Get references to page annotations.
protected
_putannotsobjs()
Output annotations objects for all pages.
!!! THIS METHOD IS NOT YET COMPLETED !!! See section 12.5 of PDF 32000_2008 reference.
protected int
_putAPXObject(int $w = 0, int $h = 0, string $stream = '')
Put appearance streams XObject used to define annotation's appearance states.
protected
_putfonts()
Output fonts.
protected
_puttruetypeunicode(array $font)
Adds unicode fonts.
Based on PDF Reference 1.3 (section 5)
protected
_putcidfont0(array $font)
Output CID-0 fonts.
A Type 0 CIDFont contains glyph descriptions based on the Adobe Type 1 font format
protected
_putimages()
Output images.
protected
_putxobjects()
Output Form XObjects Templates.
protected
_putspotcolors()
Output Spot Colors Resources.
protected string
_getxobjectdict()
Return XObjects Dictionary.
protected
_putresourcedict()
Output Resources Dictionary.
protected
_putresources()
Output Resources.
protected int
_putinfo()
Adds some Metadata information (Document Information Dictionary) (see Chapter 14.3.3 Document Information Dictionary of PDF32000_2008.pdf Reference)
setExtraXMP(string $xmp)
Set additional XMP data to be added on the default XMP data just before the end of "x:xmpmeta" tag.
IMPORTANT: This data is added as-is without controls, so you have to validate your data before using this method!
setExtraXMPRDF(string $xmp)
Set additional XMP data to be added on the default XMP data just before the end of "rdf:RDF" tag.
IMPORTANT: This data is added as-is without controls, so you have to validate your data before using this method!
protected int
_putXMP()
Put XMP data object and return ID.
protected int
_putcatalog()
Output Catalog.
protected string
_putviewerpreferences()
Output viewer preferences.
protected
_putheader()
Output PDF File Header (7.5.2).
protected
_enddoc()
Output end of document (EOF).
protected
_beginpage(string $orientation = '', mixed $format = '')
Initialize a new page.
protected
_endpage()
Mark end of page.
protected int
_newobj()
Begin a new object and return the object number.
protected string
_getobj(int|null $objid = null)
Return the starting object string for the selected object ID.
protected
_dounderline(int $x, int $y, string $txt)
Underline text.
protected
_dounderlinew(int $x, int $y, int $w)
Underline for rectangular text area.
protected
_dolinethrough(int $x, int $y, string $txt)
Line through text.
protected
_dolinethroughw(int $x, int $y, int $w)
Line through for rectangular text area.
protected
_dooverline(int $x, int $y, string $txt)
Overline text.
protected
_dooverlinew(int $x, int $y, int $w)
Overline for rectangular text area.
protected string
_datastring(string $s, int $n = 0)
Format a data string for meta information
setDocCreationTimestamp(mixed $time)
Set the document creation timestamp
setDocModificationTimestamp(mixed $time)
Set the document modification timestamp
int
getDocCreationTimestamp()
Returns document creation timestamp in seconds.
int
getDocModificationTimestamp()
Returns document modification timestamp in seconds.
protected string
_datestring(int $n = 0, int $timestamp = 0)
Returns a formatted date for meta information
protected string
_textstring(string $s, int $n = 0)
Format a text string for meta information
protected
_getrawstream(string $s, int $n = 0)
get raw output stream.
protected
_out(string $s)
Output a string to the document.
setHeaderFont(array<int,string|float|null> $font)
Set header font.
array<int,string|float|null>
getHeaderFont()
Get header font.
setFooterFont(array<int,string|float|null> $font)
Set footer font.
array<int,string|float|null>
getFooterFont()
Get Footer font.
setLanguageArray(array $language)
Set language array.
getPDFData()
Returns the PDF data.
int
addHtmlLink(string $url, string $name, bool $fill = false, bool $firstline = false, array|null $color = null, string $style = -1, bool $firstblock = false)
Output anchor link.
float
pixelsToUnits(int $px)
Converts pixels to User's Units.
string
unhtmlentities(string $text_to_convert)
Reverse function for htmlentities.
Convert entities in UTF-8.
protected int
_objectkey(int $n)
Compute encryption key depending on object number where the encrypted data is stored.
This is used for all strings and streams without crypt filter specifier.
protected string
_encrypt_data(int $n, string $s)
Encrypt the input string.
protected
_putencryption()
Put encryption on PDF document.
protected string
_Uvalue()
Compute U value (used for encryption)
protected string
_UEvalue()
Compute UE value (used for encryption)
protected string
_Ovalue()
Compute O value (used for encryption)
protected string
_OEvalue()
Compute OE value (used for encryption)
protected string
_fixAES256Password(string $password)
Convert password for AES-256 encryption mode
protected
_generateencryptionkey()
Compute encryption key
setProtection(array $permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), string $user_pass = '', string|null $owner_pass = null, int $mode = 0, array|null $pubkeys = null)
Set document protection Remark: the protection against modification is for people who have the full Acrobat product.
If you don't set any password, the document will open as usual. If you set a user password, the PDF viewer will ask for it before displaying the document. The master password, if different from the user one, can be used to get full access. Note: protecting a document requires to encrypt it, which increases the processing time a lot. This can cause a PHP time-out in some cases, especially if the document contains images or fonts.
StartTransform()
Starts a 2D tranformation saving current graphic state.
This function must be called before scaling, mirroring, translation, rotation and skewing. Use StartTransform() before, and StopTransform() after the transformations to restore the normal behavior.
StopTransform()
Stops a 2D tranformation restoring previous graphic state.
This function must be called after scaling, mirroring, translation, rotation and skewing. Use StartTransform() before, and StopTransform() after the transformations to restore the normal behavior.
ScaleX(float $s_x, int $x = '', int $y = '')
Horizontal Scaling.
ScaleY(float $s_y, int $x = '', int $y = '')
Vertical Scaling.
ScaleXY(float $s, int $x = '', int $y = '')
Vertical and horizontal proportional Scaling.
Scale(float $s_x, float $s_y, float|null $x = null, float|null $y = null)
Vertical and horizontal non-proportional Scaling.
MirrorH(float|null $x = null)
Horizontal Mirroring.
MirrorV(float|null $y = null)
Verical Mirroring.
MirrorP(float|null $x = null, float|null $y = null)
Point reflection mirroring.
MirrorL(float $angle = 0, float|null $x = null, float|null $y = null)
Reflection against a straight line through point (x, y) with the gradient angle (angle).
TranslateX(int $t_x)
Translate graphic object horizontally.
TranslateY(int $t_y)
Translate graphic object vertically.
Translate(int $t_x, int $t_y)
Translate graphic object horizontally and vertically.
Rotate(float $angle, float|null $x = null, float|null $y = null)
Rotate object.
SkewX(float $angle_x, float|null $x = null, float|null $y = null)
Skew horizontally.
SkewY(float $angle_y, float|null $x = null, float|null $y = null)
Skew vertically.
Skew(float $angle_x, float $angle_y, float|null $x = null, float|null $y = null)
Skew.
protected
Transform(array $tm)
Apply graphic transformations.
setLineWidth(float $width)
Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.
int
GetLineWidth()
Returns the current the line width.
string
setLineStyle(array $style, bool $ret = false)
Set line style.
protected
_outPoint(float $x, float $y)
Begin a new subpath by moving the current point to coordinates (x, y), omitting any connecting line segment.
protected
_outLine(float $x, float $y)
Append a straight line segment from the current point to the point (x, y).
The new current point shall be (x, y).
protected
_outRect(float $x, float $y, float $w, float $h, string $op)
Append a rectangle to the current path as a complete subpath, with lower-left corner (x, y) and dimensions widthand height in user space.
protected
_outCurve(float $x1, float $y1, float $x2, float $y2, float $x3, float $y3)
Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as the Bezier control points.
The new current point shall be (x3, y3).
protected
_outCurveV(float $x2, float $y2, float $x3, float $y3)
Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using the current point and (x2, y2) as the Bezier control points.
The new current point shall be (x3, y3).
protected
_outCurveY(float $x1, float $y1, float $x3, float $y3)
Append a cubic Bezier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the Bezier control points.
The new current point shall be (x3, y3).
Line(float $x1, float $y1, float $x2, float $y2, array $style = array())
Draws a line between two points.
Rect(float $x, float $y, float $w, float $h, string $style = '', array $border_style = array(), array $fill_color = array())
Draws a rectangle.
Curve(float $x0, float $y0, float $x1, float $y1, float $x2, float $y2, float $x3, float $y3, string $style = '', array $line_style = array(), array $fill_color = array())
Draws a Bezier curve.
The Bezier curve is a tangent to the line between the control points at either end of the curve.
Polycurve(float $x0, float $y0, float[] $segments, string $style = '', array $line_style = array(), array $fill_color = array())
Draws a poly-Bezier curve.
Each Bezier curve segment is a tangent to the line between the control points at either end of the curve.
Ellipse(float $x0, float $y0, float $rx, float $ry = 0, float $angle = 0, float $astart = 0, float $afinish = 360, string $style = '', array $line_style = array(), array $fill_color = array(), int $nc = 2)
Draws an ellipse.
An ellipse is formed from n Bezier curves.
protected array
_outellipticalarc(float $xc, float $yc, float $rx, float $ry, float $xang = 0, float $angs = 0, float $angf = 360, bool $pie = false, int $nc = 2, bool $startpoint = true, bool $ccw = true, bool $svg = false)
Append an elliptical arc to the current path.
An ellipse is formed from n Bezier curves.
Circle(float $x0, float $y0, float $r, float $angstr = 0, float $angend = 360, string $style = '', array $line_style = array(), array $fill_color = array(), int $nc = 2)
Draws a circle.
A circle is formed from n Bezier curves.
PolyLine(array $p, string $style = '', array $line_style = array(), array $fill_color = array())
Draws a polygonal line
Polygon(array $p, string $style = '', array $line_style = array(), array $fill_color = array(), bool $closed = true)
Draws a polygon.
RegularPolygon(float $x0, float $y0, float $r, int $ns, float $angle = 0, bool $draw_circle = false, string $style = '', array $line_style = array(), array $fill_color = array(), string $circle_style = '', array $circle_outLine_style = array(), array $circle_fill_color = array())
Draws a regular polygon.
StarPolygon(float $x0, float $y0, float $r, int $nv, int $ng, float $angle = 0, bool $draw_circle = false, string $style = '', array $line_style = array(), array $fill_color = array(), string $circle_style = '', array $circle_outLine_style = array(), array $circle_fill_color = array())
Draws a star polygon
RoundedRect(float $x, float $y, float $w, float $h, float $r, string $round_corner = '1111', string $style = '', array $border_style = array(), array $fill_color = array())
Draws a rounded rectangle.
RoundedRectXY(float $x, float $y, float $w, float $h, float $rx, float $ry, string $round_corner = '1111', string $style = '', array $border_style = array(), array $fill_color = array())
Draws a rounded rectangle.
Arrow(float $x0, float $y0, float $x1, float $y1, int $head_style = 0, float $arm_size = 5, int $arm_angle = 15)
Draws a grahic arrow.
string|false
setDestination(string $name, float $y = -1, int|string $page = '', float $x = -1)
Add a Named Destination.
NOTE: destination names are unique, so only last entry will be saved.
array
getDestination()
Return the Named Destination array.
protected
_putdests()
Insert Named Destinations.
setBookmark(string $txt, int $level = 0, float $y = -1, int|string $page = '', string $style = '', array $color = array(0, 0, 0), float $x = -1, mixed $link = '')
Adds a bookmark - alias for Bookmark().
Bookmark(string $txt, int $level = 0, float $y = -1, int|string $page = '', string $style = '', array $color = array(0, 0, 0), float $x = -1, mixed $link = '')
Adds a bookmark.
protected
sortBookmarks()
Sort bookmarks for page and key.
protected
_putbookmarks()
Create a bookmark PDF string.
IncludeJS(string $script)
Adds a javascript
int
addJavascriptObject(string $script, bool $onload = false)
Adds a javascript object and return object ID
protected
_putjavascript()
Create a javascript PDF string.
protected
_addfield(string $type, string $name, int $x, int $y, int $w, int $h, array $prop)
Adds a javascript form field.
setFormDefaultProp(array $prop = array())
Set default properties for form fields.
array
getFormDefaultProp()
Return the default properties for form fields.
TextField(string $name, float $w, float $h, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)
Creates a text field
RadioButton(string $name, int $w, array $prop = array(), array $opt = array(), string $onvalue = 'On', bool $checked = false, float|null $x = null, float|null $y = null, bool $js = false)
Creates a RadioButton field.
ListBox(string $name, int $w, int $h, array $values, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)
Creates a List-box field
ComboBox(string $name, int $w, int $h, array $values, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)
Creates a Combo-box field
CheckBox(string $name, int $w, bool $checked = false, array $prop = array(), array $opt = array(), string $onvalue = 'Yes', float|null $x = null, float|null $y = null, bool $js = false)
Creates a CheckBox field
Button(string $name, int $w, int $h, string $caption, mixed $action, array $prop = array(), array $opt = array(), float|null $x = null, float|null $y = null, bool $js = false)
Creates a button field
protected
_putsignature()
Add certification signature (DocMDP or UR3) You can set only one signature type
setUserRights(bool $enable = true, string $document = '/FullSave', string $annots = '/Create/Delete/Modify/Copy/Import/Export', string $form = '/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate', string $signature = '/Modify', string $ef = '/Create/Delete/Modify/Import', string $formex = '')
Set User's Rights for PDF Reader WARNING: This is experimental and currently do not work.
Check the PDF Reference 8.7.1 Transform Methods, Table 8.105 Entries in the UR transform parameters dictionary
setSignature(mixed $signing_cert = '', mixed $private_key = '', string $private_key_password = '', string $extracerts = '', int $cert_type = 2, array $info = array(), string $approval = '')
Enable document signature (requires the OpenSSL Library).
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
setSignatureAppearance(float $x = 0, float $y = 0, float $w = 0, float $h = 0, int $page = -1, string $name = '')
Set the digital signature appearance (a cliccable rectangle area to get signature properties)
addEmptySignatureAppearance(float $x = 0, float $y = 0, float $w = 0, float $h = 0, int $page = -1, string $name = '')
Add an empty digital signature appearance (a cliccable rectangle area to get signature properties)
protected array
getSignatureAppearanceArray(float $x = 0, float $y = 0, float $w = 0, float $h = 0, int $page = -1, string $name = '')
Get the array that defines the signature appearance (page and rectangle coordinates).
setTimeStamp(string $tsa_host = '', string $tsa_username = '', string $tsa_password = '', string $tsa_cert = '')
Enable document timestamping (requires the OpenSSL Library).
The trusted timestamping improve document security that means that no one should be able to change the document once it has been recorded. Use with digital signature only!
protected string
applyTSA(string $signature)
NOT YET IMPLEMENTED Request TSA for a timestamp
startPageGroup(int|null $page = null)
Create a new page group.
NOTE: call this function before calling AddPage()
setStartingPageNumber(int $num = 1)
Set the starting page number.
string
getAliasRightShift()
Returns the string alias used right align page numbers.
If the current font is unicode type, the returned string wil contain an additional open curly brace.
string
getAliasNbPages()
Returns the string alias used for the total number of pages.
If the current font is unicode type, the returned string is surrounded by additional curly braces. This alias will be replaced by the total number of pages in the document.
string
getAliasNumPage()
Returns the string alias used for the page number.
If the current font is unicode type, the returned string is surrounded by additional curly braces. This alias will be replaced by the page number.
string
getPageGroupAlias()
Return the alias for the total number of pages in the current page group.
If the current font is unicode type, the returned string is surrounded by additional curly braces. This alias will be replaced by the total number of pages in this group.
string
getPageNumGroupAlias()
Return the alias for the page number on the current page group.
If the current font is unicode type, the returned string is surrounded by additional curly braces. This alias will be replaced by the page number (relative to the belonging group).
int
getGroupPageNo()
Return the current page in the group.
getGroupPageNoFormatted()
Returns the current group page number formatted as a string.
PageNoFormatted()
Returns the current page number formatted as a string.
protected
_putocg()
Put pdf layers.
startLayer(string $name = '', bool|null $print = true, bool $view = true, bool $lock = true)
Start a new pdf layer.
endLayer()
End the current PDF layer.
setVisibility(string $v)
Set the visibility of the successive elements.
This can be useful, for instance, to put a background image or color that will show on screen but won't print.
protected int|void
addExtGState(array $parms)
Add transparency parameters to the current extgstate
protected
setExtGState(int $gs)
Add an extgstate
protected
_putextgstates()
Put extgstates for object transparency
setOverprint(bool $stroking = true, bool|null $nonstroking = null, int $mode = 0)
Set overprint mode for stroking (OP) and non-stroking (op) painting operations.
(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
array<string,bool|int>
getOverprint()
Get the overprint mode array (OP, op, OPM).
(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
setAlpha(float $stroking = 1, string $bm = 'Normal', float|null $nonstroking = null, bool $ais = false)
Set alpha for stroking (CA) and non-stroking (ca) operations.
array<string,bool|string>
getAlpha()
Get the alpha mode array (CA, ca, BM, AIS).
(Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
setJPEGQuality(int $quality)
Set the default JPEG compression quality (1-100)
setDefaultTableColumns(int $cols = 4)
Set the default number of columns in a row for HTML tables.
setCellHeightRatio(float $h)
Set the height of the cell (line height) respect the font height.
float
getCellHeightRatio()
return the height of cell repect font height.
setPDFVersion(string $version = '1.7')
Set the PDF version (check PDF reference for valid values).
setViewerPreferences(array $preferences)
Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.
(see Section 8.1 of PDF reference, "Viewer Preferences").
- HideToolbar boolean (Optional) A flag specifying whether to hide the viewer application's tool bars when the document is active. Default value: false.
- HideMenubar boolean (Optional) A flag specifying whether to hide the viewer application's menu bar when the document is active. Default value: false.
- HideWindowUI boolean (Optional) A flag specifying whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed. Default value: false.
- FitWindow boolean (Optional) A flag specifying whether to resize the document's window to fit the size of the first displayed page. Default value: false.
- CenterWindow boolean (Optional) A flag specifying whether to position the document's window in the center of the screen. Default value: false.
- DisplayDocTitle boolean (Optional; PDF 1.4) A flag specifying whether the window's title bar should display the document title taken from the Title entry of the document information dictionary (see Section 10.2.1, "Document Information Dictionary"). If false, the title bar should instead display the name of the PDF file containing the document. Default value: false.
- NonFullScreenPageMode name (Optional) The document's page mode, specifying how to display the document on exiting full-screen mode:
- UseNone Neither document outline nor thumbnail images visible
- UseOutlines Document outline visible
- UseThumbs Thumbnail images visible
- UseOC Optional content group panel visible
- 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
- 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
colorRegistrationBar(float $x, float $y, float $w, float $h, bool $transition = true, bool $vertical = false, string $colors = 'A,R,G,B,C,M,Y,K')
Paints color transition registration bars
cropMark(float $x, float $y, float $w, float $h, string $type = 'T,R,B,L', array $color = array(100, 100, 100, 100, 'All'))
Paints crop marks.
registrationMark(float $x, float $y, float $r, bool $double = false, array $cola = array(100, 100, 100, 100, 'All'), array $colb = array(0, 0, 0, 0, 'None'))
Paints a registration mark
registrationMarkCMYK(float $x, float $y, float $r)
Paints a CMYK registration mark
LinearGradient(float $x, float $y, float $w, float $h, array $col1 = array(), array $col2 = array(), array $coords = array(0, 0, 1, 0))
Paints a linear colour gradient.
RadialGradient(float $x, float $y, float $w, float $h, array $col1 = array(), array $col2 = array(), array $coords = array(0.5, 0.5, 0.5, 0.5, 1))
Paints a radial colour gradient.
CoonsPatchMesh(float $x, float $y, float $w, float $h, array $col1 = array(), array $col2 = array(), array $col3 = array(), array $col4 = array(), array $coords = array(0.0, 0.0, 0.33, 0.0, 0.67, 0.0, 1.0, 0.0, 1.0, 0.33, 1.0, 0.67, 1.0, 1.0, 0.67, 1.0, 0.33, 1.0, 0.0, 1.0, 0.0, 0.67, 0.0, 0.33), array $coords_min = 0, array $coords_max = 1, bool $antialias = false)
Paints a coons patch mesh.
protected
Clip(float $x, float $y, float $w, float $h)
Set a rectangular clipping area.
Gradient(int $type, array $coords, array $stops, array $background = array(), bool $antialias = false)
Output gradient.
protected
_putshaders()
Output gradient shaders.
PieSector(float $xc, float $yc, float $r, float $a, float $b, string $style = 'FD', float $cw = true, float $o = 90)
Draw the sector of a circle.
It can be used for instance to render pie charts.
PieSectorXY(float $xc, float $yc, float $rx, float $ry, float $a, float $b, string $style = 'FD', float $cw = false, float $o = 0, int $nc = 2)
Draw the sector of an ellipse.
It can be used for instance to render pie charts.
ImageEps(string $file, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, mixed $link = '', bool $useBoundingBox = true, string $align = '', string $palign = '', mixed $border = 0, bool $fitonpage = false, bool $fixoutvals = false)
Embed vector-based Adobe Illustrator (AI) or AI-compatible EPS files.
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).
setBarcode(string $bc = '')
Set document barcode.
string
getBarcode()
Get current 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 = '')
Print a Linear 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 = '', bool $distort = false)
Print 2D Barcode.
array
getMargins()
Returns an array containing current margins:
- $ret['left'] = left margin
- $ret['right'] = right margin
- $ret['top'] = top margin
- $ret['bottom'] = bottom margin
- $ret['header'] = header margin
- $ret['footer'] = footer margin
- $ret['cell'] = cell padding array
- $ret['padding_left'] = cell left padding
- $ret['padding_top'] = cell top padding
- $ret['padding_right'] = cell right padding
- $ret['padding_bottom'] = cell bottom padding
array
getOriginalMargins()
Returns an array containing original margins:
- $ret['left'] = left margin
- $ret['right'] = right margin
float
getFontSize()
Returns the current font size.
int
getFontSizePt()
Returns the current font size in points unit.
string
getFontFamily()
Returns the current font family name.
string
getFontStyle()
Returns the current font style.
string
fixHTMLCode(string $html, string $default_css = '', array|null $tagvs = null, array|null $tidy_options = null)
Cleanup HTML code (requires HTML Tidy library).
protected int
getCSSBorderWidth(string $width)
Returns the border width from CSS property
protected int
getCSSBorderDashStyle(string $style)
Returns the border dash style from CSS property
protected array
getCSSBorderStyle(string $cssborder)
Returns the border style array from CSS border properties
array
getCSSPadding(string $csspadding, float $width = 0)
Get the internal Cell padding from CSS attribute.
array
getCSSMargin(string $cssmargin, float $width = 0)
Get the internal Cell margin from CSS attribute.
array
getCSSBorderMargin(string $cssbspace, float $width = 0)
Get the border-spacing from CSS attribute.
protected float
getCSSFontSpacing(string $spacing, float $parent = 0)
Returns the letter-spacing value from CSS value
protected float
getCSSFontStretching(string $stretch, float $parent = 100)
Returns the percentage of font stretching from CSS value
float
getHTMLFontUnits(string $val, float $refsize = 12, float $parent_size = 12, string $defaultunit = 'pt')
Convert HTML string containing font size value to points
protected array
getHtmlDomArray(string $html)
Returns the HTML DOM array.
protected string
getSpaceString()
Returns the string used to find spaces
protected string
hashTCPDFtag(string $data)
Calculates the hash value of the given data.
string
serializeTCPDFtag(string $method, array $params = array())
Serialize data to be used with TCPDF tag in HTML code.
protected array
unserializeTCPDFtag(string $data)
Unserialize data to be used with TCPDF tag in HTML code.
protected bool
allowedTCPDFtag(string $method)
Check if a TCPDF tag is allowed
writeHTMLCell(float $w, float $h, float|null $x, float|null $y, string $html = '', mixed $border = 0, int $ln = 0, bool $fill = false, bool $reseth = true, string $align = '', bool $autopadding = true)
Prints a cell (rectangular area) with optional borders, background color and html text string.
The upper-left corner of the cell corresponds to the current position. After the call, the current position moves to the right or to the next line.
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting.
Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul
NOTE: all the HTML attributes must be enclosed in double-quote.
writeHTML(string $html, bool $ln = true, bool $fill = false, bool $reseth = false, bool $cell = false, string $align = '')
Allows to preserve some HTML formatting (limited support).
IMPORTANT: The HTML must be well formatted - try to clean-up it using an application like HTML-Tidy before submitting.
Supported tags are: a, b, blockquote, br, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, img, li, ol, p, pre, small, span, strong, sub, sup, table, tcpdf, td, th, thead, tr, tt, u, ul NOTE: all the HTML attributes must be enclosed in double-quote.
protected array
openHTMLTagHandler(array $dom, int $key, bool $cell)
Process opening tags.
protected array
closeHTMLTagHandler(array $dom, int $key, bool $cell, int $maxbottomliney = 0)
Process closing tags.
protected
addHTMLVertSpace(string $hbz = 0, string $hb = 0, bool $cell = false, bool $firsttag = false, bool $lasttag = false)
Add vertical spaces if needed.
protected array
getBorderStartPosition()
Return the starting coordinates to draw an html border
protected
drawHTMLTagBorder(array $tag, int $xmax)
Draw an HTML block border and fill
setLIsymbol(string $symbol = '!')
Set the default bullet to be used as LI bullet symbol
setBooklet(bool $booklet = true, float $inner = -1, float $outer = -1)
Set the booklet mode for double-sided pages.
protected
swapMargins(bool $reverse = true)
Swap the left and right margins.
setHtmlVSpace(array $tagvs)
Set the vertical spaces for HTML tags.
The array must have the following structure (example): $tagvs = array('h1' => array(0 => array('h' => '', 'n' => 2), 1 => array('h' => 1.3, 'n' => 1))); The first array level contains the tag names, the second level contains 0 for opening tags or 1 for closing tags, the third level contains the vertical space unit (h) and the number spaces to add (n). If the h parameter is not specified, default values are used.
setListIndentWidth(float $width)
Set custom width for list indentation.
setOpenCell(bool $isopen)
Set the top/bottom cell sides to be open or closed when the cell cross the page.
setHtmlLinksStyle(array $color = array(0, 0, 255), string $fontstyle = 'U')
Set the color and font style for HTML links.
float
getHTMLUnitToUnits(string $htmlval, string $refsize = 1, string $defaultunit = 'px', bool $points = false)
Convert HTML string containing value and unit of measure to user's units or points.
protected
putHtmlListBullet(int $listdepth, string $listtype = '', float $size = 10)
Output an HTML list bullet or ordered item symbol
protected array
getGraphicVars()
Returns current graphic variables as array.
protected
setGraphicVars(array $gvars, bool $extended = false)
Set graphic variables.
protected
_outSaveGraphicsState()
Outputs the "save graphics state" operator 'q'
protected
_outRestoreGraphicsState()
Outputs the "restore graphics state" operator 'Q'
protected
setBuffer(string $data)
Set buffer content (always append data).
protected
replaceBuffer(string $data)
Replace the buffer content
protected string
getBuffer()
Get buffer content.
protected
setPageBuffer(int $page, string $data, bool $append = false)
Set page buffer content.
protected string
getPageBuffer(int $page)
Get page buffer content.
protected int
setImageBuffer(string $image, array $data)
Set image buffer content.
protected
setImageSubBuffer(string $image, string $key, array $data)
Set image buffer content for a specified sub-key.
protected string|false
getImageBuffer(string $image)
Get image buffer content.
protected
setFontBuffer(string $font, array $data)
Set font buffer content.
protected
setFontSubBuffer(string $font, string $key, mixed $data)
Set font buffer content.
protected string|false
getFontBuffer(string $font)
Get font buffer content.
bool
movePage(int $frompage, int $topage)
Move a page to a previous position.
bool
deletePage(int $page)
Remove the specified page.
bool
copyPage(int $page = 0)
Clone the specified page to a new page.
addTOC(int|null $page = null, string $numbersfont = '', string $filler = '.', string $toc_name = 'TOC', string $style = '', array $color = array(0, 0, 0))
Output a Table of Content Index (TOC).
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.
addHTMLTOC(int|null $page = null, string $toc_name = 'TOC', array $templates = array(), bool $correct_align = true, string $style = '', array $color = array(0, 0, 0))
Output a Table Of Content Index (TOC) using HTML templates.
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.
startTransaction()
Stores a copy of the current TCPDF object used for undo operation.
commitTransaction()
Delete the copy of the current TCPDF object used for undo operation.
TCPDF
rollbackTransaction(bool $self = false)
This method allows to undo the latest transaction by returning the latest saved TCPDF object with startTransaction().
setEqualColumns(int $numcols = 0, int $width = 0, int|null $y = null)
Set multiple columns of the same size
resetColumns()
Remove columns and reset page margins.
setColumnsArray(array $columns)
Set columns array.
Each column is represented by an array of arrays with the following keys: (w = width, s = space between columns, y = column top position).
selectColumn(int|null $col = null)
Set position at a given column
int
getColumn()
Return the current column number
int
getNumberOfColumns()
Return the current number of columns.
setTextRenderingMode(int $stroke = 0, bool $fill = true, bool $clip = false)
Set Text rendering mode.
setTextShadow(array $params = array('enabled' => false, 'depth_w' => 0, 'depth_h' => 0, 'color' => false, 'opacity' => 1, 'blend_mode' => 'Normal'))
Set parameters for drop shadow effect for text.
array
getTextShadow()
Return the text shadow parameters array.
protected array
hyphenateWord(array $word, array $patterns, array $dictionary = array(), int $leftmin = 1, int $rightmin = 2, int $charmin = 1, int $charmax = 8)
Returns an array of chars containing soft hyphens.
string
hyphenateText(string $text, mixed $patterns, array $dictionary = array(), int $leftmin = 1, int $rightmin = 2, int $charmin = 1, int $charmax = 8)
Returns text with soft hyphens.
setRasterizeVectorImages(bool $mode)
Enable/disable rasterization of vector images using ImageMagick library.
setFontSubsetting(bool $enable = true)
Enable or disable default option for font subsetting.
bool
getFontSubsetting()
Return the default option for font subsetting.
string
stringLeftTrim(string $str, string $replace = '')
Left trim the input string
string
stringRightTrim(string $str, string $replace = '')
Right trim the input string
string
stringTrim(string $str, string $replace = '')
Trim the input string
bool
isUnicodeFont()
Return true if the current font is unicode type.
string
getFontFamilyName(string $fontfamily)
Return normalized font name
string|false
startTemplate(int $w = 0, int $h = 0, mixed $group = false)
Start a new XObject Template.
An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images). An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked. Note: X,Y coordinates will be reset to 0,0.
string|false
endTemplate()
End the current XObject Template started with startTemplate() and restore the previous graphic state.
An XObject Template is a PDF block that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images). An XObject Template may be painted multiple times, either on several pages or at several locations on the same page and produces the same results each time, subject only to the graphics state at the time it is invoked.
printTemplate(string $id, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, string $align = '', string $palign = '', bool $fitonpage = false)
Print an XObject Template.
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.
setFontStretching(int $perc = 100)
Set the percentage of character stretching.
float
getFontStretching()
Get the percentage of character stretching.
setFontSpacing(float $spacing = 0)
Set the amount to increase or decrease the space between characters in a text.
int
getFontSpacing()
Get the amount to increase or decrease the space between characters in a text.
array
getPageRegions()
Return an array of no-write page regions
setPageRegions(array $regions = array())
Set no-write regions on page.
A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. A region is always aligned on the left or right side of the page ad is defined using a vertical segment. You can set multiple regions for the same page.
addPageRegion(array $region)
Add a single no-write region on selected page.
A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. A region is always aligned on the left or right side of the page ad is defined using a vertical segment. You can set multiple regions for the same page.
removePageRegion(int $key)
Remove a single no-write region.
protected float[]
checkPageRegions(float $h, float $x, float $y)
Check page for no-write regions and adapt current coordinates and page margins if necessary.
A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. A region is always aligned on the left or right side of the page ad is defined using a vertical segment.
ImageSVG(string $file, float|null $x = null, float|null $y = null, float $w = 0, float $h = 0, mixed $link = '', string $align = '', string $palign = '', mixed $border = 0, bool $fitonpage = false)
Embedd a Scalable Vector Graphics (SVG) image.
NOTE: SVG standard is not yet fully implemented, use the setRasterizeVectorImages() method to enable/disable rasterization of vector images using ImageMagick library.
protected array
convertSVGtMatrix(array $tm)
Convert SVG transformation matrix to PDF.
protected
SVGTransform(array $tm)
Apply SVG graphic transformation matrix.
protected string
setSVGStyles(array $svgstyle, array $prevsvgstyle, int $x = 0, int $y = 0, int $w = 1, int $h = 1, string $clip_function = '', array $clip_params = array())
Apply the requested SVG styles ( TO BE COMPLETED )
protected array
SVGPath(string $d, string $style = '')
Draws an SVG path
protected
removeTagNamespace(string $name)
Return the tag name without the namespace
protected
startSVGElementHandler(resource|string $parser, string $name, array $attribs, array $ctm = array())
Sets the opening SVG element handler function for the XML parser. ( TO BE COMPLETED )
protected
endSVGElementHandler(resource|string $parser, string $name)
Sets the closing SVG element handler function for the XML parser.
protected
segSVGContentHandler(resource $parser, string $data)
Sets the character data handler function for the XML parser.
protected string
getCachedFileContents(string $file)
Keeps files in memory, so it doesn't need to downloaded everytime in a loop
protected bool
fileExists(string $file)
Avoid multiple calls to an external server to see if a file exists