HTML

HTML PDF class

Table of contents

Namespace: Com\Tecnick\Pdf

Extends: JavaScript

Abstract: Yes

File: HTML.php line 281

HTML PDF class

Tags

  • since: 2002-08-03
  • category: Library
  • author: Nicola Asuni info@tecnick.com
  • copyright: 2002-2026 Nicola Asuni - Tecnick.com LTD
  • license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
  • link: https://github.com/tecnickcom/tc-lib-pdf
  • phpstan-import-type: BorderStyle from \Com\Tecnick\Pdf\CSS
  • phpstan-import-type: BorderStyleOpt from \Com\Tecnick\Pdf\CSS
  • phpstan-import-type: TCSSBorderSpacing from \Com\Tecnick\Pdf\CSS
  • phpstan-import-type: TCSSData from \Com\Tecnick\Pdf\CSS
  • phpstan-import-type: TCellDef from \Com\Tecnick\Pdf\Base
  • phpstan-import-type: StyleDataOpt from \Com\Tecnick\Pdf\Cell
  • phpstan-import-type: TCellBound from \Com\Tecnick\Pdf\Base
  • phpstan-import-type: TTextDims from \Com\Tecnick\Pdf\Font\Stack
  • phpstan-import-type: TAnnotOpts from \Com\Tecnick\Pdf\Base
  • phpstan-import-type: TRefUnitValues from \Com\Tecnick\Pdf\Base
  • phpstan-type: THTMLTableCell array{ cellx: float, cellw: float, colindex: int, colspan: int, contenth: float, valign: string, bstyles: array<int|string, BorderStyle>, fillstyle: ?BorderStyle, buffer: string }
  • phpstan-type: THTMLTableRowspanCell array{ cellx: float, cellw: float, colindex: int, colspan: int, rowtop: float, rowsremaining: int, usedheight: float, contenth: float, valign: string, bstyles: array<int|string, BorderStyle>, fillstyle: ?BorderStyle, buffer: string }
  • phpstan-type: THTMLTableState array{ originx: float, originy: float, captiontopy: float, width: float, dir: string, cols: int, colwidth: float, colwidths: array<int, float>, cellspacingh: float, cellspacingv: float, cellpadding: float, collapse: bool, hascellborders: bool, prevrowbottom: array<int, BorderStyle>, rowtop: float, rowheight: float, minheight: float, domkey: int, colindex: int, cells: array<int, THTMLTableCell>, occupied: array<int, int>, rowspans: array<int, THTMLTableRowspanCell>, regionoffset: float }
  • phpstan-type: THTMLTableCellContext array{ originx: float, originy: float, maxwidth: float, maxheight: float, lineadvance: float, linebottom: float, lineascent: float, linewordspacing: float, linewrapped: bool, rowtop: float, cellx: float, cellw: float, colindex: int, colspan: int, padding: array{‘T’: float, ‘R’: float, ‘B’: float, ‘L’: float}, margin: array{‘T’: float, ‘R’: float, ‘B’: float, ‘L’: float}, bstyles: array<int|string, BorderStyle>, fillstyle: ?BorderStyle, rowspan: int, valign: string, buffer: string }
  • phpstan-type: THTMLAttrib array{ ‘align’: bool|float|string, ‘attribute’: array<string, string|array<string, mixed», ‘caption-top-html’?: string, ‘caption-bottom-html’?: string, ‘caption-side’: string, ‘bgcolor’: bool|float|string, ‘block’: bool, ‘border-collapse’: string, ‘border-spacing’?: TCSSBorderSpacing, ‘border’: array<string, BorderStyle>, ‘clip’: bool, ‘cols’: int, ‘content’: string, ‘cssdata’: array<string, TCSSData>, ‘csssel’: array, ‘clear’: string, ‘dir’: string, ‘display’: string, ’empty-cells’: string, ’elkey’: int, ‘fgcolor’: string, ‘fill’: bool, ‘font-size-adjust’: float|string, ‘font-stretch’: float, ‘font-variant’: string, ‘fontname’: string, ‘fontsize’: float, ‘fontstyle’: string, ‘height’: float, ‘hide’: bool, ’letter-spacing’: float, ’line-height’: float, ’line-height-absolute’?: float, ’line-height-font-size-basis’?: bool, ’list-style-position’: string, ’listtype’: string, ’listtypeset’: bool, ‘float’: string, ‘margin’: array<string, float>, ‘opening’: bool, ‘orphans’: int, ‘overflow-wrap’?: string, ‘page’: string, ‘padding’: array<string, float>, ‘parent’: int, ‘pendingcellpadding’?: float, ‘pendingcellspacingh’?: float, ‘pendingcellspacingv’?: float, ‘pendingcolwidths’?: array<int, float>, ‘position’: string, ‘quotes’: string, ‘rows’: int, ‘self’: bool, ‘stroke’: float, ‘strokecolor’: string, ‘childblockbottom’?: float, ‘ctxoriginx’?: float, ‘ctxmaxwidth’?: float, ‘ctxregionoffset’?: float, ‘inlineblocknextx’?: float, ‘inlineblockrowy’?: float, ‘inlineblockpageid’?: int, ’table-layout’: string, ‘style’: array<string, string>, ’list-style-image’?: string, ’tag’: bool, ’text-indent’: float, ’text-transform’: string, ’thead’: string, ’trids’: array, ‘valign’: string, ‘value’: string, ‘white-space’: string, ‘widows’: int, ‘word-break’?: string, ‘word-spacing’: float, ‘width’: float, ‘x’: float, ‘y’: float, }
  • phpstan-type: THTMLBlockBuf array{ openkey: int, bx: float, by: float, bw: float, buffer: string, celldepth: int, decorate: bool }
  • phpstan-type: THTMLRenderContext array{ ‘cellctx’: array{ originx: float, originy: float, lineoriginx: float, maxwidth: float, maxheight: float, floatrowleftw: float, floatrowrightw: float, floatrowtop: float, floatrowbottom: float, lineadvance: float, linebottom: float, lineascent: float, lineascentnolookahead: bool, linewordspacing: float, linewrapped: bool, textindentapplied: bool, firstlineinset: float, pendingblockmarginb: float, activepage?: string, regionoffset?: float, basefont: string }, ‘currentkey’?: int, ‘fontcache’: array<string, array<string, mixed», ’liststack’: array<int, array{ type: string, count: int, indent: float }>, ’tablestack’: array<int, THTMLTableState>, ‘bcellctx’: array<int, THTMLTableCellContext>, ‘blockbuf’: array<int, THTMLBlockBuf>, ’linkstack’: array<int, string>, ’listack’: array<int, array{ originx: float, maxwidth: float }>, ‘prelevel’: int, ‘quotelevel’: int, ‘dom’: array<int, THTMLAttrib>, }
  • phpstan-type: THTMLRtlPiece array{ key: int, text: string, image: bool, src: string, width: float, height: float, valign: string }
  • phpstan-type: THTMLRtlSegment array{ key: int, text: string, width: float, ascent: float, image: bool, height: float, valign: string, src: string }
  • mixin
  • SuppressWarnings: (“PHPMD.DepthOfInheritance”)

Constants

BORDERPOS_DEFAULT

File: Base.php line 1405

public mixed BORDERPOS_DEFAULT = 0.0

BORDERPOS_EXTERNAL

File: Base.php line 1411

public mixed BORDERPOS_EXTERNAL = -0.5

BORDERPOS_INTERNAL

File: Base.php line 1417

public mixed BORDERPOS_INTERNAL = 0.5

ZEROCELL

File: Base.php line 1436

public TCellDef ZEROCELL = ['margin' => self::ZEROCELLBOUND, 'padding' => self::ZEROCELLBOUND, 'borderpos' => self::BORDERPOS_DEFAULT]

ZEROCELLBOUND

File: Base.php line 1424

public TCellBound ZEROCELLBOUND = ['T' => 0.0, 'R' => 0.0, 'B' => 0.0, 'L' => 0.0]

Properties

$barcode

File: Base.php line 732

public Barcode $barcode

$cache

File: Base.php line 747

public Cache $cache

$color

File: Base.php line 727

public PdfColor $color

$encrypt

File: Base.php line 722

public Encrypt $encrypt

$file

File: Base.php line 737

public File $file

$font

File: Base.php line 773

public Stack $font

$graph

File: Base.php line 768

public Draw $graph

$image

File: Base.php line 778

public Import $image

$markupFile

File: Base.php line 742

public File $markupFile

$page

File: Base.php line 763

public Page $page

$pon

File: Base.php line 1148

public int $pon = 0

$uniconv

File: Base.php line 758

public Convert $uniconv

Methods

addArtifactContent()

File: Text.php line 1036

public addArtifactContent(string $content, int $pid[, string $type = '' ][, string $subtype = '' ]) : void

This is the preferred API for decorative graphics and page furniture because it writes the wrapped content directly to the selected page.

Parameters

  • $content : string: Raw PDF operators to wrap.
  • $pid : int: Page index.
  • $type : string = ‘’: Optional Artifact /Type (for example ‘Pagination’).
  • $subtype : string = ‘’: Optional Artifact /Subtype (for example ‘Header’ or ‘Footer’).

Tags

  • throws: Exception

addContentAsEmbeddedFile()

File: JavaScript.php line 772

public addContentAsEmbeddedFile(string $file, string $content[, string $mime = 'application/octet-stream' ][, string|AFRelationship $afrel = 'Source' ][, string $desc = '' ]) : void

If a file with the same name already exists, it will be ignored.

Parameters

  • $file : string: File name to be used a key for the embedded file.
  • $content : string: Content of the embedded file.
  • $mime : string = ‘application/octet-stream’: MIME type of the file (e.g., ‘application/xml’).
  • $afrel : string|AFRelationship = ‘Source’: AFRelationship value (Source, Data, Alternative, Supplement, Unspecified) or enum.
  • $desc : string = ‘’: Optional description of the file.

Tags

addEmbeddedFile()

File: JavaScript.php line 721

public addEmbeddedFile(string $file[, string $mime = 'application/octet-stream' ][, string|AFRelationship $afrel = 'Source' ][, string $desc = '' ]) : void

If a file with the same name already exists, it will be ignored.

Parameters

  • $file : string: File name (absolute or relative path).
  • $mime : string = ‘application/octet-stream’: MIME type of the file (e.g., ‘application/xml’).
  • $afrel : string|AFRelationship = ‘Source’: AFRelationship value (Source, Data, Alternative, Supplement, Unspecified) or enum.
  • $desc : string = ‘’: Optional description of the file.

Tags

addFFButton()

File: JavaScript.php line 1501

public addFFButton(string $name, float $posx, float $posy, float $width, float $height, string $caption, string|array<string, mixed> $action[, TAnnotOpts $opt = ['subtype' => 'Widget'] ][, array<string, mixed> $jsp = [] ]) : int

Parameters

  • $name : string: field name.
  • $posx : float: horizontal position in user units (LTR).
  • $posy : float: vertical position in user units (LTR).
  • $width : float: width in user units.
  • $height : float: height in user units.
  • $caption : string: caption.
  • $action : string|array<string, mixed>: action triggered by pressing the button. Use a string to specify a javascript action. Use an array to specify a form action options as in section 12.7.5 of PDF32000_2008.
  • $opt : TAnnotOpts = [‘subtype’ => ‘Widget’]: Array of options (Annotation Types) - all lowercase.
  • $jsp : array<string, mixed> = []: javascript field properties (see: Javascript for Acrobat API reference).

Tags

  • throws: Exception in case of error.
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception

Return values

int —

PDF Object ID.

addFFCheckBox()

File: JavaScript.php line 1662

public addFFCheckBox(string $name, float $posx, float $posy, float $width[, string $onvalue = 'Yes' ][, bool $checked = false ][, TAnnotOpts $opt = ['subtype' => 'Widget'] ][, array<string, mixed> $jsp = [] ]) : int

Parameters

  • $name : string: field name.
  • $posx : float: horizontal position in user units (LTR).
  • $posy : float: vertical position in user units (LTR).
  • $width : float: width in user units.
  • $onvalue : string = ‘Yes’: Value to be returned if selected.
  • $checked : bool = false: Define the initial state.
  • $opt : TAnnotOpts = [‘subtype’ => ‘Widget’]: Array of options (Annotation Types) - all lowercase.
  • $jsp : array<string, mixed> = []: javascript field properties (see: Javascript for Acrobat API reference).

Tags

  • throws: Exception in case of error.
  • throws: Exception
  • throws: Exception
  • throws: Exception

Return values

int —

PDF Object ID.

addFFComboBox()

File: JavaScript.php line 1739

public addFFComboBox(string $name, float $posx, float $posy, float $width, float $height, array<string|int, array{string, string}>|array<string|int, string> $values[, TAnnotOpts $opt = ['subtype' => 'Widget'] ][, array<string, mixed> $jsp = [] ]) : int

Parameters

  • $name : string: field name.
  • $posx : float: horizontal position in user units (LTR).
  • $posy : float: vertical position in user units (LTR).
  • $width : float: width in user units.
  • $height : float: height in user units.
  • $values : array<string|int, array{string, string}>|array<string|int, string>: List of selection values.
  • $opt : TAnnotOpts = [‘subtype’ => ‘Widget’]: Array of options (Annotation Types) - all lowercase.
  • $jsp : array<string, mixed> = []: javascript field properties (see: Javascript for Acrobat API reference).

Tags

  • throws: Exception in case of error.
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception

Return values

int —

PDF Object ID.

addFFListBox()

File: JavaScript.php line 1812

public addFFListBox(string $name, float $posx, float $posy, float $width, float $height, array<string|int, array{string, string}>|array<string|int, string> $values[, TAnnotOpts $opt = ['subtype' => 'Widget'] ][, array<string, mixed> $jsp = [] ]) : int

Parameters

  • $name : string: field name.
  • $posx : float: horizontal position in user units (LTR).
  • $posy : float: vertical position in user units (LTR).
  • $width : float: width in user units.
  • $height : float: height in user units.
  • $values : array<string|int, array{string, string}>|array<string|int, string>: List of selection values.
  • $opt : TAnnotOpts = [‘subtype’ => ‘Widget’]: Array of options (Annotation Types) - all lowercase.
  • $jsp : array<string, mixed> = []: javascript field properties (see: Javascript for Acrobat API reference).

Tags

  • throws: Exception in case of error.
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception

Return values

int —

PDF Object ID.

addFFRadioButton()

File: JavaScript.php line 1882

public addFFRadioButton(string $name, float $posx, float $posy, float $width[, string $onvalue = 'On' ][, bool $checked = false ][, TAnnotOpts $opt = ['subtype' => 'Widget'] ][, array<string, mixed> $jsp = [] ]) : int

Parameters

  • $name : string: field name.
  • $posx : float: horizontal position in user units (LTR).
  • $posy : float: vertical position in user units (LTR).
  • $width : float: width in user units.
  • $onvalue : string = ‘On’: Value to be returned if selected.
  • $checked : bool = false: Define the initial state.
  • $opt : TAnnotOpts = [‘subtype’ => ‘Widget’]: Array of options (Annotation Types) - all lowercase.
  • $jsp : array<string, mixed> = []: javascript field properties (see: Javascript for Acrobat API reference).

Tags

  • throws: Exception in case of error.
  • throws: Exception
  • throws: Exception
  • throws: Exception

Return values

int —

PDF Object ID.

addFFText()

File: JavaScript.php line 1982

public addFFText(string $name, float $posx, float $posy, float $width, float $height[, TAnnotOpts $opt = ['subtype' => 'text'] ][, array<string, mixed> $jsp = [] ]) : int

Parameters

  • $name : string: field name.
  • $posx : float: horizontal position in user units (LTR).
  • $posy : float: vertical position in user units (LTR).
  • $width : float: width in user units.
  • $height : float: height in user units.
  • $opt : TAnnotOpts = [‘subtype’ => ’text’]: Array of options (Annotation Types) - all lowercase.
  • $jsp : array<string, mixed> = []: javascript field properties (see: Javascript for Acrobat API reference).

Tags

  • throws: Exception in case of error.
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception

Return values

int —

PDF Object ID.

addGlobalCSS()

File: CSS.php line 223

public addGlobalCSS(string $css) : void

Parameters

  • $css : string: CSS content without surrounding