TCPDF
class TCPDF (View source)
Properties
| protected Tcpdf|null | $eng | The tc-lib-pdf engine that renders the actual document. |
|
| protected string | $docunit | Unit of measure ('pt', 'mm', 'cm', 'in'). |
|
| protected float | $kratio | Scale factor: number of points per user unit. |
|
| protected bool | $unicode | Unicode mode flag. |
|
| protected string | $charencoding | Document encoding (only 'UTF-8' is supported by the engine). |
|
| protected string | $pdfamode | PDF/A mode passed to the engine ('' = disabled). |
|
| protected string | $deforientation | Default page orientation ('P' or 'L'). |
|
| protected mixed | $defformat | Default page format (format name string or [width, height] in user units). |
|
| protected string | $curorientation | Current page orientation. |
|
| protected mixed | $curformat | Current page format. |
|
| protected int | $docstate | Document state: 0 = not started, 1 = open, 2 = has pages, 3 = closed. |
|
| protected string | $pdfraw | Cached raw PDF output (built once at close time). |
|
| protected float | $lmargin | Left margin in user units. |
|
| protected float | $tmargin | Top margin in user units. |
|
| protected float | $rmargin | Right margin in user units. |
|
| protected float | $bmargin | Page-break bottom margin in user units. |
|
| protected float | $orig_lmargin | Original margins (used by header/footer rendering). |
|
| protected float | $orig_rmargin | Original right margin in user units. |
|
| protected bool | $autopagebreak | Automatic page break flag. |
|
| protected float | $posx | Current abscissa (user units, from left page edge). |
|
| protected float | $posy | Current ordinate (user units, from top page edge). |
|
| protected float | $lasth | Height of the last printed cell (user units). |
|
| protected float | $cellheightratio | Cell height ratio (line height = font size * ratio). |
|
| protected array{L: float, T: float, R: float, B: float} | $cellpadding | ||
| protected array{L: float, T: float, R: float, B: float} | $cellmargin | ||
| protected string | $fontfamily | Current font family (normalized lowercase). |
|
| protected string | $fontstyle | Current font style letters (subset of 'B', 'I'). |
|
| protected array{U: bool, D: bool, O: bool} | $fontdecor | ||
| protected float | $fontsizept | Current font size in points. |
|
| protected array<string, mixed> | $fontmetric | ||
| protected bool | $fontsubsetting | Default font subsetting mode for setFont (legacy default: true). |
|
| protected float | $fontspacing | Extra font spacing (user units) applied via the engine font stack. |
|
| protected float | $fontstretching | Font stretching percentage (100 = none). |
|
| protected string | $monospacedfont | Default monospaced font family. |
|
| protected string | $textcolorspec | Text color: engine color specification string. |
|
| protected string | $drawcolorspec | Draw (stroke) color: engine color specification string. |
|
| protected string | $fillcolorspec | Fill color: engine color specification string. |
|
| protected array<int|float> | $textcolorlegacy | ||
| protected array<int|float> | $drawcolorlegacy | ||
| protected array<int|float> | $fillcolorlegacy | ||
| protected float | $linewidth | Current line width in user units. |
|
| protected StyleDataOpt | $linestyle | ||
| protected bool | $rtlmode | RTL direction flag. |
|
| protected mixed | $tmprtl | Temporary RTL mode ('R', 'L' or false). |
|
| protected bool | $printheader | Print header flag. |
|
| protected bool | $printfooter | Print footer flag. |
|
| protected array{logo: string, logo_width: float, title: string, string: string, text_color: array<int, float|int|string>, line_color: array<int, float|int|string>} | $headerdata | ||
| protected array{text_color: array<int, float|int|string>, line_color: array<int, float|int|string>} | $footerdata | ||
| protected float | $headermargin | Header margin (minimum distance between header and top page margin). |
|
| protected float | $footermargin | Footer margin (minimum distance between footer and bottom page margin). |
|
| protected array{0: string, 1: string, 2: float} | $headerfont | ||
| protected array{0: string, 1: string, 2: float} | $footerfont | ||
| protected bool | $inheaderfooter | True while rendering the page header or footer. |
|
| protected array<int|string, mixed> | $langdata | Language dependent strings (legacy $l array): built-in English defaults, overridable via the K_TCPDF_DEFAULT_LANGUAGE constant or setLanguageArray(). |
|
| protected float | $imgscale | Image scale ratio (used when width/height are not specified). |
|
| protected int | $jpegquality | JPEG quality used when re-encoding images. |
|
| protected float | $imagerbx | Bottom-right X coordinate of the last inserted image. |
|
| protected float | $imagerby | Bottom-right Y coordinate of the last inserted image. |
|
| protected array<int, string> | $imagemasks | ||
| protected int | $imagemaskseq | Sequence for image mask handles. |
|
| protected array{stroke: float, fill: bool, clip: bool} | $textrendermode | ||
| protected array{enabled: bool, depth_w: int|float, depth_h: int|float, color: mixed, opacity: int|float, blend_mode: string} | $textshadow | ||
| protected int | $startingpagenumber | Starting page number (used by PageNoFormatted). |
|
| protected int | $decortotalpages | Total number of pages, available while rendering deferred decorations. |
|
| protected string | $docbarcode | Document barcode string (printed in the footer when set). |
|
| protected bool | $bookletmode | Booklet mode flag. |
|
| protected | $tocpage | True when the current page is a TOC page. |
|
| protected array{CA: float, ca: float, BM: string, AIS: bool} | $alpha | ||
| protected array{OP: bool, op: bool, OPM: int} | $overprint | ||
| protected int | $openlayers | Number of currently open optional-content layers. |
|
| protected TCPDF|null | $transactionsnapshot | Snapshot of the facade object used by the transaction API. |
|
| protected array<int, array{page: int, y: float}> | $internallinks | ||
| protected array<string, mixed> | $nameddests | ||
| protected string | $xobjtid | Identifier of the currently open XObject template ('' = none). |
|
| protected float | $xobjheight | Height of the currently open XObject template in user units. |
|
| protected int | $nextpagegroup | Page group number for the next added page (0 = default group). |
|
| protected bool | $pagegroupsused | True when page groups are in use. |
|
| protected int | $pagecolumns | Columns requested via setEqualColumns() for subsequently added pages. |
|
| protected float | $pagecolumnwidth | Column width requested via setEqualColumns() (0 = divide the content width evenly). |
|
| protected array<int, array{RX: float, RY: float, RW: float, RH: float}> | $pageregions | ||
| protected array<int, array{page: int, xt: float, yt: float, xb: float, yb: float, side: string}> | $nowriteareas | Legacy no-write page regions (setPageRegions()): rectangular/trapezoidal exclusion zones that flowing text and HTML must avoid. Stored verbatim in the legacy form and converted to engine banded writable regions at flow time (see applyNoWriteRegionsForFlow()). |
|
| protected array<string, mixed> | $formdefaultprop | ||
| protected array<int, float|int|string> | $htmllinkcolor | ||
| protected string | $htmllinkstyle | HTML link font style letters. |
|
| protected bool | $htmlnopadding | True while rendering HTML that must ignore the current cell padding (legacy writeHTML without $cell). |
|
| protected array{create: int, modify: int} | $doctimestamps | ||
| protected array<int, array{header: bool, footer: bool}> | $pagedecor | ||
| protected array{zoom: int|string, layout: string, mode: string} | $displaymode |
Methods
No description
No description
Legacy protected properties historically read by TCPDF subclasses (e.g. $this->AutoPageBreak, $this->lMargin), mapped to facade state.
No description
Create (or re-create) the tc-lib-pdf engine for the given unit.
Raw PDF operators for the ambient text state that must open every page content stream: the engine re-emits the current font (carrying its spacing/stretching) when it adds a page, so the facade only needs to carry the legacy text color across page breaks.
Local paths the engine may read files from. The legacy API loaded images and fonts from application-relative locations, so in addition to the engine defaults this allows the configured TCPDF paths, the current working directory and the running script directory.
Assemble the file-access options handed to the engine's shared file helper (tc-lib-file). These drive the upstream security sandbox that governs which local paths and remote hosts external resources (images, fonts, SVG, ...) may be loaded from.
Return the engine instance.
Append raw PDF content to the current page (no-op when no page exists).
Normalize a legacy orientation value to 'P' or 'L'.
Map the legacy $pdfa constructor flag onto an engine conformance mode.
Build the engine page data array for a new page.
Convert a legacy color definition (component list or array) to an engine color specification string.
Convert legacy color components (setColor-style) to a spec string.
Sanitize a legacy color component array (numbers, optional spot name).
Current line style as an engine style array (lineWidth, lineColor, ...).
Build the engine per-side styles array from a legacy border argument.
Mirror legacy adjustCellPadding(): a cell border reserves a minimum cell padding so the stroke does not overlap the text, and the optional position mode decides how much of the stroke falls inside the cell box:
- ext : the whole stroke is painted outside -> 0 padding, the border rectangle grows outward;
- int : the whole stroke is painted inside -> a full line-width padding, the border rectangle shrinks inward;
- normal : the stroke straddles the edge -> half line-width.
Convert a legacy line style array (width, cap, join, dash, phase, color) to an engine style array.
Map a legacy shape style letter combination to an engine paint mode.
Build the engine style for a legacy (line_style, fill_color) pair.
Convert a legacy per-segment/per-side style list to engine styles.
Resolve a legacy optional coordinate ('' or null means current position).
Complete partial per-side styles with the current graph style defaults (the engine HTML renderer requires fully-populated style arrays).
Trigger an automatic page break when the given height does not fit.
Move to the top of the next page for an automatic break, reusing an already-created page when one exists.
Map a legacy text vertical alignment letter to the engine convention.
Legacy $calign cell vertical alignment: the amount (user units) by which the cell box top is shifted UP relative to the current text line. The font-relative modes (A/L/D) depend on $valign, mirroring getCellCode().
Map a legacy horizontal alignment letter to the engine convention.
Bookmark outline entries collected by the engine.
Replace the engine bookmark outline entries (used to remap page targets after the TOC pages are relocated).
Emulate the legacy text shadow for engine-rendered HTML content.
Lowest bottom edge (user units from the page top) of the images placed in the content chunks appended after the given index.
Number of raw content chunks of the given engine page.
Move the content chunks appended after the given index to the front of the page stream, so they paint behind the page body. Used for deferred header rendering: the legacy engine painted headers at page-start time, i.e. under the body content.
Number of entries currently on the engine cell bounding-box stack.
Lowest bottom edge (user units) among the cell bounding boxes pushed on the engine stack after the given index.
PDF code for a cell background fill and the requested border sides.
Draw the per-page border/fill segments of an auto-height HTML cell that flowed across pages (the engine skips the cell box in that case).
Insert a PDF content chunk at the given position of an engine page content stream, so it paints behind the chunks that follow it.
PDF code for a stretched cell text run (legacy Cell stretch modes).
Re-apply the current font to the engine font stack so it carries the up-to-date spacing/stretching.
Raw PDF code that renders the current font's natural (unstretched, unspaced) measurement of the given text width in user units.
Current engine text shadow array (or null when disabled).
Forced text direction for the engine ('' = inherit document direction).
Canonicalize a local file path before handing it to the engine.
Register an external link annotation for the given rectangle.
Render the deferred page decorations (headers and footers) on every page. Called once when the document is closed: at that time the total page count is known, so the default footer can print real numbers.
No description
No description
No description
No description
No description
No description
No description
No description
Return the cell height for the given font size.
No description
No description
No description
No description
No description
Return the page width in user units.
Return the page height in user units.
Return the automatic page-break bottom margin.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Match legacy TCPDF: when bookmark outlines are present the document opens with the outline (bookmark) panel visible (/PageMode /UseOutlines).
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Return the length of a string in user units.
Return the width of a character array in user units.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Estimate the number of lines needed to print the given text.
No description
Fill the empty lines of a multi-line text with a single space.
Map the legacy text row pitch onto the engine text-cell inputs.
No description
Return the current font metric array (inserting the default when missing).
No description
Apply a legacy 8-bit soft mask to an image by writing it into the image's alpha channel, then return the merged PNG content. The engine's import path then splits that alpha back out into a /SMask (the only soft-mask mechanism tc-lib-pdf-image exposes), reproducing legacy's separate-mask Image() call. Returns null when the images cannot be read (caller falls back to the unmasked file).
Return the pixel size of an image file or '@'-prefixed data stream.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Normalize legacy list/combo values: either a list of strings or a list of [export, display] pairs (the engine requires a homogeneous list).
Normalize legacy form-field (prop, opt) pairs for the engine.
Attach a freshly created annotation/form-field widget to the current page so the engine emits it in the page's /Annots array.
Advance the horizontal cursor after placing a form field, matching the legacy behaviour where each field method shifts the current X position by the field width (RTL-aware). The shift is applied to the live cursor regardless of any explicit x/y override, exactly as legacy TCPDF does.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Register the ExtGState referenced by the given command with the open XObject template resource dictionary.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Convert a legacy Coons patch-mesh array (per-patch 'f', 'points', and 'colors' with 0-255 r/g/b keys) to the engine shape (normalized red/green/blue floats).
No description
No description
No description
[BREAKING CHANGE] EPS/AI vector import is not supported.
No description
No description
No description
No description
Render a barcode at the given position via the engine.
Render a 1D barcode with the legacy geometry: bars, the optional human-readable label and the vertical padding all fit inside the requested height (barh = height - text_height - 2*vpadding) instead of the label being appended below it. Bar drawing is delegated to the engine; the box, label and cursor advance mirror write1DBarcode().
Render a 2D barcode with the legacy geometry: the barcode cells are inset inside the requested box by the (auto) padding quiet-zone and the aspect ratio is preserved unless $distort is set. Mirrors write2DBarcode().
Move to the next page when a barcode of the given height would not fit below the current Y, preserving the abscissa. Returns the Y to draw at.
Left edge of a barcode box for the legacy position keyword (L/C/R or the current abscissa for the empty/default case).
Background fill and/or border around a barcode box.
Advance the cursor next to a drawn barcode for the legacy $align value.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Parse a CSS shorthand box value (top right bottom left) into user units.
No description
No description
No description
Make a relative local markup resource path absolute.
Return a markup resource path that survives CSS lowercasing.
Flatten styled inline elements that contain nested inline children.
Adapt legacy-tolerant HTML markup for the stricter engine renderer.
Render HTML containing embedded
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Legacy equal-column geometry: the requested width is capped to an even share of the content width and the remainder becomes the inter-column gutters.
Replace the region (column) layout of the current engine page.
True when the current page is split into multiple column regions.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
The legacy no-write areas registered for the current page, in the engine setNoWriteRegions() input format (xt/yt/xb/yb/side).
(Re)build the engine banded writable regions for the current page from its legacy no-write areas, using $bandheight as the height of each horizontal slice, then select the region that contains the current Y so the flow starts at the cursor and hugs the obstacles band by band. The text/HTML engine then advances region -> region -> fresh full-width page on its own.
Select the (top-to-bottom ordered) writable region of the current page whose vertical span contains $y, so a flow that starts at the cursor begins in the right band. Falls back to the first region when $y sits above them all.
Band height (one writable slice) for a no-write region flow of HTML: the cell height of the body (outermost) font size declared in the fragment, falling back to the current font. A slice should be about one body line tall so the bands hug the obstacle without wasting vertical space (which would push too much text onto the continuation page); larger inline runs sit in the tall merged region at the top rather than at a band boundary.
No description
Details
__construct($_orientation = 'P', $_unit = 'mm', $_format = 'A4', $_unicode = true, $_encoding = 'UTF-8', $_diskcache = false, $_pdfa = false)
No description
__destruct()
No description
__get($name)
Legacy protected properties historically read by TCPDF subclasses (e.g. $this->AutoPageBreak, $this->lMargin), mapped to facade state.
__isset($name)
No description
protected void
engineInit(string $unit)
Create (or re-create) the tc-lib-pdf engine for the given unit.
protected string
ambientPageContent()
Raw PDF operators for the ambient text state that must open every page content stream: the engine re-emits the current font (carrying its spacing/stretching) when it adds a page, so the facade only needs to carry the legacy text color across page breaks.
protected array
fileAllowedPaths()
Local paths the engine may read files from. The legacy API loaded images and fonts from application-relative locations, so in addition to the engine defaults this allows the configured TCPDF paths, the current working directory and the running script directory.
Applications may extend this allowlist with the K_ALLOWED_PATHS configuration constant (array of path prefixes): its entries are merged on top of the built-in defaults, never replacing them.
protected array
fileOptions()
Assemble the file-access options handed to the engine's shared file helper (tc-lib-file). These drive the upstream security sandbox that governs which local paths and remote hosts external resources (images, fonts, SVG, ...) may be loaded from.
The mapping is configuration-driven:
- allowedPaths <- built-in defaults + K_ALLOWED_PATHS (local reads)
- allowedHosts <- K_ALLOWED_HOSTS (remote HTTP/HTTPS reads; empty disables remote loading entirely — the safe default)
- maxRemoteSize <- K_MAX_REMOTE_SIZE (byte cap on remote downloads)
- curlopts <- K_CURLOPTS (per-request cURL overrides)
Only explicitly configured keys are forwarded; anything omitted keeps the upstream library's secure defaults.
protected Tcpdf
engine()
Return the engine instance.
protected void
emitToPage(string $content)
Append raw PDF content to the current page (no-op when no page exists).
protected string
normalizeOrientation(mixed $orientation)
Normalize a legacy orientation value to 'P' or 'L'.
protected string
normalizePdfaMode(mixed $pdfa)
Map the legacy $pdfa constructor flag onto an engine conformance mode.
protected array
buildPageData(mixed $orientation, mixed $format)
Build the engine page data array for a new page.
protected string
colorSpecFromLegacy(mixed $color)
Convert a legacy color definition (component list or array) to an engine color specification string.
Legacy conventions: 1 component = grayscale 0-255; 3 components = RGB 0-255; 4 components = CMYK 0-100; 5th component = spot color name.
protected string
colorSpecFromComponents(mixed $col1, mixed $col2, mixed $col3, mixed $col4, string $name)
Convert legacy color components (setColor-style) to a spec string.
protected array
legacyColorComponents(mixed $color, array $default)
Sanitize a legacy color component array (numbers, optional spot name).
protected array
currentLineStyle()
Current line style as an engine style array (lineWidth, lineColor, ...).
protected array
stylesFromLegacyBorder(mixed $border, bool $fill)
Build the engine per-side styles array from a legacy border argument.
protected array
legacyBorderCellMetrics(mixed $border)
Mirror legacy adjustCellPadding(): a cell border reserves a minimum cell padding so the stroke does not overlap the text, and the optional position mode decides how much of the stroke falls inside the cell box:
- ext : the whole stroke is painted outside -> 0 padding, the border rectangle grows outward;
- int : the whole stroke is painted inside -> a full line-width padding, the border rectangle shrinks inward;
- normal : the stroke straddles the edge -> half line-width.
The derived padding only ever increases the current cell padding (it never shrinks it) and grows the auto cell height exactly like legacy.
protected array
styleFromLegacyLineStyle(array $style)
Convert a legacy line style array (width, cap, join, dash, phase, color) to an engine style array.
protected string
shapeModeFromLegacy(mixed $style, bool $hasfill, bool $close = false)
Map a legacy shape style letter combination to an engine paint mode.
protected array
shapeStyleFromLegacy(mixed $linestyle, mixed $fillcolor)
Build the engine style for a legacy (line_style, fill_color) pair.
The legacy drawing methods PERSIST these parameters: a style array updates the current line style and a fill color array updates the current fill color (subsequent shapes inherit them).
protected array
segmentStylesFromLegacy(mixed $linestyle, mixed $fillcolor)
Convert a legacy per-segment/per-side style list to engine styles.
Integer 0 entries mean "do not draw this segment".
protected float
coordOrCursor(mixed $value, bool $vertical)
Resolve a legacy optional coordinate ('' or null means current position).
protected array
completeSideStyles(array $styles)
Complete partial per-side styles with the current graph style defaults (the engine HTML renderer requires fully-populated style arrays).
protected void
breakIfNeeded(float $height)
Trigger an automatic page break when the given height does not fit.
protected void
advanceToNextPage()
Move to the top of the next page for an automatic break, reusing an already-created page when one exists.
Legacy startPage() reuses the next page (if numpages > page: page++)
instead of always appending, so a cell the caller placed back on an
earlier page (e.g. the MultiRow pattern of example_020, which writes
the two columns at the same Y on the start page) still breaks onto the
single shared continuation page rather than spawning a fresh one. The
current abscissa is preserved across the break, like breakIfNeeded().
protected string
valignToEngine(mixed $valign)
Map a legacy text vertical alignment letter to the engine convention.
protected float
cellCalignShift(string $calign, string $valign, float $height)
Legacy $calign cell vertical alignment: the amount (user units) by which the cell box top is shifted UP relative to the current text line. The font-relative modes (A/L/D) depend on $valign, mirroring getCellCode().
protected string
halignToEngine(mixed $align)
Map a legacy horizontal alignment letter to the engine convention.
protected array
engineOutlines()
Bookmark outline entries collected by the engine.
protected void
setEngineOutlines(array $outlines)
Replace the engine bookmark outline entries (used to remap page targets after the TOC pages are relocated).
protected void
applyHtmlTextShadow(int $pid, int $start)
Emulate the legacy text shadow for engine-rendered HTML content.
The engine HTML renderer has no shadow support, so the text objects (BT..ET blocks) of the freshly rendered chunks are duplicated into an offset, shadow-colored, alpha-blended layer painted underneath.
protected float
pageContentImageBottom(int $pid, int $start, float $fallback)
Lowest bottom edge (user units from the page top) of the images placed in the content chunks appended after the given index.
Image placements carry their position in the CTM: "w 0 0 h x y cm /IMGn Do" with y = bottom edge in PDF coordinates.
protected int
pageContentCount(int $pid)
Number of raw content chunks of the given engine page.
protected void
movePageContentToFront(int $pid, int $start)
Move the content chunks appended after the given index to the front of the page stream, so they paint behind the page body. Used for deferred header rendering: the legacy engine painted headers at page-start time, i.e. under the body content.
protected int
cellBBoxCount()
Number of entries currently on the engine cell bounding-box stack.
protected float
cellBBoxBottomSince(int $start, float $fallback)
Lowest bottom edge (user units) among the cell bounding boxes pushed on the engine stack after the given index.
protected string
cellBoxOutput(float $posx, float $posy, float $width, float $height, array $styles, bool $fill)
PDF code for a cell background fill and the requested border sides.
protected void
drawHtmlCellSegments(float $posx, float $width, float $starty, float $bottom, int $startpage, int $contentstart, array $styles, bool $fill, int|null $endpage = null)
Draw the per-page border/fill segments of an auto-height HTML cell that flowed across pages (the engine skips the cell box in that case).
Legacy MultiCell splits the frame at each break in open-cell mode: the segment before a page break has no bottom edge and runs to the break trigger, the segment after it has no top edge and restarts from the top margin. Each segment is inserted behind its page content.
protected void
insertPageContent(int $pid, int $start, string $content)
Insert a PDF content chunk at the given position of an engine page content stream, so it paints behind the chunks that follow it.
protected string
stretchedCellText(int $mode, string $txt, float $width, float $height, float $textw, string $valign, array|null $shadow)
PDF code for a stretched cell text run (legacy Cell stretch modes).
Modes 1/2 scale the glyphs horizontally (via a CTM transform around the text anchor); modes 3/4 adjust the character spacing (via a Tc operator). The engine renders the text at its NATURAL width (the font stack is neutralised for this run), so its line splitting never triggers, and the ambient spacing/stretching plus the fit transform are emitted here as self-contained text-state operators.
protected void
refreshFontState()
Re-apply the current font to the engine font stack so it carries the up-to-date spacing/stretching.
The engine reads spacing (points) and stretching (ratio) from the current font and emits the matching Tc/Tz operators (with their resets) per text run, so changing them only needs to refresh the stacked font; the font selection (Tf) is unchanged and need not be re-emitted.
protected float
naturalOrdWidth(string $txt)
Raw PDF code that renders the current font's natural (unstretched, unspaced) measurement of the given text width in user units.
Used by the legacy Cell stretch modes, whose fit math is expressed against the natural glyph widths while the engine font stack already carries the ambient spacing/stretching.
protected array|null
engineShadow()
Current engine text shadow array (or null when disabled).
protected string
forcedTextDir()
Forced text direction for the engine ('' = inherit document direction).
protected string
resolveLocalFile(string $file)
Canonicalize a local file path before handing it to the engine.
The engine file helper rejects paths containing '..' components for security; the legacy API accepted them, so resolve local paths first.
protected void
attachLink(mixed $link, float $posx, float $posy, float $width, float $height)
Register an external link annotation for the given rectangle.
protected void
decorateAllPages()
Render the deferred page decorations (headers and footers) on every page. Called once when the document is closed: at that time the total page count is known, so the default footer can print real numbers.
setPageUnit($_unit)
No description
setPageOrientation($_orientation, $_autopagebreak = null, $_bottommargin = null)
No description
setSpacesRE($_re = '/[^\S\xa0]/')
No description
setRTL($_enable, $_resetx = true)
No description
bool
getRTL()
No description
setTempRTL($_mode)
No description
bool
isRTLTextDir()
No description
setLastH($_h)
No description
float
getCellHeight(int|float $_fontsize, bool $_padding = true)
Return the cell height for the given font size.
resetLastH()
No description
float
getLastH()
No description
setImageScale($_scale)
No description
float
getImageScale()
No description
getPageDimensions($_pagenum = null)
No description
float
getPageWidth(int|null $_pagenum = null)
Return the page width in user units.
float
getPageHeight(int|null $_pagenum = null)
Return the page height in user units.
float
getBreakMargin(int|null $_pagenum = null)
Return the automatic page-break bottom margin.
float
getScaleFactor()
No description
setMargins($_left, $_top, $_right = null, $_keepmargins = false)
No description
setLeftMargin($_margin)
No description
setTopMargin($_margin)
No description
setRightMargin($_margin)
No description
setCellPadding($_pad)
No description
setCellPaddings($_left = null, $_top = null, $_right = null, $_bottom = null)
No description
array{L: float, T: float, R: float, B: float}
getCellPaddings()
No description
setCellMargins($_left = null, $_top = null, $_right = null, $_bottom = null)
No description
array{L: float, T: float, R: float, B: float}
getCellMargins()
No description
setAutoPageBreak($_auto, $_margin = 0)
No description
bool
getAutoPageBreak()
No description
setDisplayMode($_zoom, $_layout = 'SinglePage', $_mode = 'UseNone')
No description
setCompression($_compress = true)
No description
setSRGBmode($_mode = false)
No description
setDocInfoUnicode($_unicode = true)
No description
setTitle($_title)
No description
setSubject($_subject)
No description
setAuthor($_author)
No description
setKeywords($_keywords)
No description
setCreator($_creator)
No description
setAllowLocalFiles($_allowLocalFiles)
No description
Error($_msg)
No description
Open()
No description
Close()
No description
protected void
applyBookmarkDisplayMode()
Match legacy TCPDF: when bookmark outlines are present the document opens with the outline (bookmark) panel visible (/PageMode /UseOutlines).
The engine only promotes the page mode to UseOutlines when it is the empty string, but the default mode is UseNone, so that promotion never fires on its own. Apply it here from the facade, preserving the tracked zoom and layout, unless the user explicitly selected a non-default display mode.
setPage($_pnum, $_resetmargins = false)
No description
lastPage($_resetmargins = false)
No description
int
getPage()
No description
int
getNumPages()
No description
addTOCPage($_orientation = '', $_format = '', $_keepmargins = false)
No description
endTOCPage()
No description
AddPage($_orientation = '', $_format = '', $_keepmargins = false, $_tocpage = false)
No description
endPage($_tocpage = false)
No description
startPage($_orientation = '', $_format = '', $_tocpage = false)
No description
setPageMark()
No description
setHeaderData($_ln = '', $_lw = 0, $_ht = '', $_hs = '', $_tc = [0, 0, 0], $_lc = [0, 0, 0])
No description
setFooterData($_tc = [0, 0, 0], $_lc = [0, 0, 0])
No description
array{logo: string, logo_width: float, title: string, string: string, text_color: array<int, float|int|string>, line_color: array<int, float|int|string>}
getHeaderData()
No description
setHeaderMargin($_hm = 10)
No description
float
getHeaderMargin()
No description
setFooterMargin($_fm = 10)
No description
float
getFooterMargin()
No description
setPrintHeader($_val = true)
No description
setPrintFooter($_val = true)
No description
float
getImageRBX()
No description
float
getImageRBY()
No description
resetHeaderTemplate()
No description
setHeaderTemplateAutoreset($_val = true)
No description
Header()
No description
Footer()
No description
int
PageNo()
No description
getAllSpotColors()
No description
AddSpotColor($_name, $_c, $_m, $_y, $_k)
No description
setSpotColor($_type, $_name, $_tint = 100)
No description
setDrawSpotColor($_name, $_tint = 100)
No description
setFillSpotColor($_name, $_tint = 100)
No description
setTextSpotColor($_name, $_tint = 100)
No description
setColorArray($_type, $_color, $_ret = false)
No description
setDrawColorArray($_color, $_ret = false)
No description
setFillColorArray($_color, $_ret = false)
No description
setTextColorArray($_color, $_ret = false)
No description
setColor($_type, $_col1 = 0, $_col2 = -1, $_col3 = -1, $_col4 = -1, $_ret = false, $_name = '')
No description
setDrawColor($_col1 = 0, $_col2 = -1, $_col3 = -1, $_col4 = -1, $_ret = false, $_name = '')
No description
setFillColor($_col1 = 0, $_col2 = -1, $_col3 = -1, $_col4 = -1, $_ret = false, $_name = '')
No description
setTextColor($_col1 = 0, $_col2 = -1, $_col3 = -1, $_col4 = -1, $_ret = false, $_name = '')
No description
float|array<int, float>
GetStringWidth(string $_s, string $_fontname = '', string $_fontstyle = '', int|float $_fontsize = 0, bool $_getarray = false)
Return the length of a string in user units.
float|array<int, float>
GetArrStringWidth(array<int, int|string> $_sa, string $_fontname = '', string $_fontstyle = '', int|float $_fontsize = 0, bool $_getarray = false)
Return the width of a character array in user units.
GetCharWidth($_char, $_notlast = true)
No description
float
getRawCharWidth(int|string $_char)
No description
GetNumChars($_s)
No description
AddFont($_family, $_style = '', $_fontfile = '', $_subset = 'default')
No description
setFont($_family, $_style = '', $_size = null, $_fontfile = '', $_subset = 'default', $_out = true)
No description
setFontSize($_size, $_out = true)
No description
getFontBBox()
No description
getAbsFontMeasure($_s)
No description
getCharBBox($_char)
No description
getFontDescent($_font, $_style = '', $_size = 0)
No description
getFontAscent($_font, $_style = '', $_size = 0)
No description
isCharDefined($_char, $_font = '', $_style = '')
No description
replaceMissingChars($_text, $_font = '', $_style = '', $_subs = [])
No description
setDefaultMonospacedFont($_font)
No description
AddLink()
No description
setLink($_link, $_y = 0, $_page = -1)
No description
Link($_x, $_y, $_w, $_h, $_link, $_spaces = 0)
No description
Annotation($_x, $_y, $_w, $_h, $_text, $_opt = ['Subtype' => 'Text'], $_spaces = 0)
No description
EmbedFile($_opt)
No description
EmbedFileFromString($_filename, $_content)
No description
Text($_x, $_y, $_txt, $_fstroke = 0, $_fclip = false, $_ffill = true, $_border = 0, $_ln = 0, $_align = '', $_fill = false, $_link = '', $_stretch = 0, $_ignore_min_height = false, $_calign = 'T', $_valign = 'M', $_rtloff = false)
No description
bool
AcceptPageBreak()
No description
Cell($_w, $_h = 0, $_txt = '', $_border = 0, $_ln = 0, $_align = '', $_fill = false, $_link = '', $_stretch = 0, $_ignore_min_height = false, $_calign = 'T', $_valign = 'M')
No description
MultiCell($_w, $_h, $_txt, $_border = 0, $_align = 'J', $_fill = false, $_ln = 1, $_x = null, $_y = null, $_reseth = true, $_stretch = 0, $_ishtml = false, $_autopadding = true, $_maxh = 0, $_valign = 'T', $_fitcell = false)
No description
int
getNumLines($_txt, $_w = 0, $_reseth = false, $_autopadding = true, $_cellpadding = null, $_border = 0)
Estimate the number of lines needed to print the given text.
getStringHeight($_w, $_txt, $_reseth = false, $_autopadding = true, $_cellpadding = null, $_border = 0)
No description
protected string
preserveBlankLines(string $txt)
Fill the empty lines of a multi-line text with a single space.
The engine drops empty lines from the rendered output: a line with no characters produces no text operator and no bounding-box advance, so consecutive line breaks collapse into one. The legacy API preserves each empty line as a full line feed, so give every empty line a single (invisible) space character to force the engine to render and advance past it. Line counting is unaffected: the engine already counts empty lines when measuring the cell, only their rendering position is lost.
protected array
legacyRowPitch(float $pitch, bool $withpadding = false)
Map the legacy text row pitch onto the engine text-cell inputs.
Legacy rendering emits every text line as a cell at least getCellHeight() tall with the text vertically centered in it, while the engine stacks the lines at the bare font metric height below the cell top. The extra leading between the rows becomes the engine inter-line space and half of it (the centering of the first line inside its row) is added to the cell top padding.
Write($_h, $_txt, $_link = '', $_fill = false, $_align = '', $_ln = false, $_stretch = 0, $_firstline = false, $_firstblock = false, $_maxh = 0, $_wadj = 0, $_margin = null)
No description
protected array
currentFontMetric()
Return the current font metric array (inserting the default when missing).
Image($_file, $_x = null, $_y = null, $_w = 0, $_h = 0, $_type = '', $_link = '', $_align = '', $_resize = false, $_dpi = 300, $_palign = '', $_ismask = false, $_imgmask = false, $_border = 0, $_fitbox = false, $_hidden = false, $_fitonpage = false, $_alt = false, $_altimgs = [])
No description
protected string|null
mergeImageAlphaMask(string $basefile, string $maskfile)
Apply a legacy 8-bit soft mask to an image by writing it into the image's alpha channel, then return the merged PNG content. The engine's import path then splits that alpha back out into a /SMask (the only soft-mask mechanism tc-lib-pdf-image exposes), reproducing legacy's separate-mask Image() call. Returns null when the images cannot be read (caller falls back to the unmasked file).
Mask polarity follows the PDF soft-mask convention used by legacy: a white mask pixel is fully opaque, a black one fully transparent.
protected array
imagePixelSize(string $file)
Return the pixel size of an image file or '@'-prefixed data stream.
Ln($_h = null, $_cell = false)
No description
float
GetX()
No description
float
GetAbsX()
No description
float
GetY()
No description
setX($_x, $_rtloff = false)
No description
setY($_y, $_resetx = true, $_rtloff = false)
No description
setXY($_x, $_y, $_rtloff = false)
No description
setAbsX($_x)
No description
setAbsY($_y)
No description
setAbsXY($_x, $_y)
No description
Output($_name = 'doc.pdf', $_dest = 'I')
No description
getPDFData()
No description
setExtraXMP($_xmp)
No description
setExtraXMPRDF($_xmp)
No description
setExtraXMPPdfaextension($_xmp)
No description
setDocCreationTimestamp($_time)
No description
setDocModificationTimestamp($_time)
No description
getDocCreationTimestamp()
No description
getDocModificationTimestamp()
No description
setHeaderFont($_font)
No description
array{0: string, 1: string, 2: float}
getHeaderFont()
No description
setFooterFont($_font)
No description
array{0: string, 1: string, 2: float}
getFooterFont()
No description
setLanguageArray($_language)
No description
addHtmlLink($_url, $_name, $_fill = false, $_firstline = false, $_color = null, $_style = -1, $_firstblock = false)
No description
pixelsToUnits($_px)
No description
unhtmlentities($_text_to_convert)
No description
setProtection($_permissions = ['print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'], $_user_pass = '', $_owner_pass = null, $_mode = 0, $_pubkeys = null)
No description
StartTransform()
No description
StopTransform()
No description
ScaleX($_s_x, $_x = '', $_y = '')
No description
ScaleY($_s_y, $_x = '', $_y = '')
No description
ScaleXY($_s, $_x = '', $_y = '')
No description
Scale($_s_x, $_s_y, $_x = null, $_y = null)
No description
MirrorH($_x = null)
No description
MirrorV($_y = null)
No description
MirrorP($_x = null, $_y = null)
No description
MirrorL($_angle = 0, $_x = null, $_y = null)
No description
TranslateX($_t_x)
No description
TranslateY($_t_y)
No description
Translate($_t_x, $_t_y)
No description
Rotate($_angle, $_x = null, $_y = null)
No description
SkewX($_angle_x, $_x = null, $_y = null)
No description
SkewY($_angle_y, $_x = null, $_y = null)
No description
Skew($_angle_x, $_angle_y, $_x = null, $_y = null)
No description
setLineWidth($_width)
No description
float
GetLineWidth()
No description
setLineStyle($_style, $_ret = false)
No description
Line($_x1, $_y1, $_x2, $_y2, $_style = [])
No description
Rect($_x, $_y, $_w, $_h, $_style = '', $_border_style = [], $_fill_color = [])
No description
Curve($_x0, $_y0, $_x1, $_y1, $_x2, $_y2, $_x3, $_y3, $_style = '', $_line_style = [], $_fill_color = [])
No description
Polycurve($_x0, $_y0, $_segments, $_style = '', $_line_style = [], $_fill_color = [])
No description
Ellipse($_x0, $_y0, $_rx, $_ry = 0, $_angle = 0, $_astart = 0, $_afinish = 360, $_style = '', $_line_style = [], $_fill_color = [], $_nc = 2)
No description
Circle($_x0, $_y0, $_r, $_angstr = 0, $_angend = 360, $_style = '', $_line_style = [], $_fill_color = [], $_nc = 2)
No description
PolyLine($_p, $_style = '', $_line_style = [], $_fill_color = [])
No description
Polygon($_p, $_style = '', $_line_style = [], $_fill_color = [], $_closed = true)
No description
RegularPolygon($_x0, $_y0, $_r, $_ns, $_angle = 0, $_draw_circle = false, $_style = '', $_line_style = [], $_fill_color = [], $_circle_style = '', $_circle_outLine_style = [], $_circle_fill_color = [])
No description
StarPolygon($_x0, $_y0, $_r, $_nv, $_ng, $_angle = 0, $_draw_circle = false, $_style = '', $_line_style = [], $_fill_color = [], $_circle_style = '', $_circle_outLine_style = [], $_circle_fill_color = [])
No description
RoundedRect($_x, $_y, $_w, $_h, $_r, $_round_corner = '1111', $_style = '', $_border_style = [], $_fill_color = [])
No description
RoundedRectXY($_x, $_y, $_w, $_h, $_rx, $_ry, $_round_corner = '1111', $_style = '', $_border_style = [], $_fill_color = [])
No description
Arrow($_x0, $_y0, $_x1, $_y1, $_head_style = 0, $_arm_size = 5, $_arm_angle = 15)
No description
setDestination($_name, $_y = -1, $_page = '', $_x = -1)
No description
getDestination()
No description
setBookmark($_txt, $_level = 0, $_y = -1, $_page = '', $_style = '', $_color = [0, 0, 0], $_x = -1, $_link = '')
No description
Bookmark($_txt, $_level = 0, $_y = -1, $_page = '', $_style = '', $_color = [0, 0, 0], $_x = -1, $_link = '')
No description
IncludeJS($_script)
No description
addJavascriptObject($_script, $_onload = false)
No description
setFormDefaultProp($_prop = [])
No description
getFormDefaultProp()
No description
protected array
formFieldValues(mixed $values)
Normalize legacy list/combo values: either a list of strings or a list of [export, display] pairs (the engine requires a homogeneous list).
protected array
formFieldOptions(mixed $prop, mixed $opt)
Normalize legacy form-field (prop, opt) pairs for the engine.
protected void
attachAnnotRef(int $oid)
Attach a freshly created annotation/form-field widget to the current page so the engine emits it in the page's /Annots array.
The engine's addFF*()/setAnnotation()/setLink() methods register the annotation object and return its id, but leave page attachment to the caller (see Com\Tecnick\Pdf\JavaScript::setAnnotation). An id of 0 means the object was not created (e.g. captured by an XObject template or suppressed in PDF/X mode) and must not be referenced.
protected void
advanceFormFieldX(float $width)
Advance the horizontal cursor after placing a form field, matching the legacy behaviour where each field method shifts the current X position by the field width (RTL-aware). The shift is applied to the live cursor regardless of any explicit x/y override, exactly as legacy TCPDF does.
TextField($_name, $_w, $_h, $_prop = [], $_opt = [], $_x = null, $_y = null, $_js = false)
No description
RadioButton($_name, $_w, $_prop = [], $_opt = [], $_onvalue = 'On', $_checked = false, $_x = null, $_y = null, $_js = false)
No description
ListBox($_name, $_w, $_h, $_values, $_prop = [], $_opt = [], $_x = null, $_y = null, $_js = false)
No description
ComboBox($_name, $_w, $_h, $_values, $_prop = [], $_opt = [], $_x = null, $_y = null, $_js = false)
No description
CheckBox($_name, $_w, $_checked = false, $_prop = [], $_opt = [], $_onvalue = 'Yes', $_x = null, $_y = null, $_js = false)
No description
Button($_name, $_w, $_h, $_caption, $_action, $_prop = [], $_opt = [], $_x = null, $_y = null, $_js = false)
No description
setUserRights($_enable = true, $_document = '/FullSave', $_annots = '/Create/Delete/Modify/Copy/Import/Export', $_form = '/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate', $_signature = '/Modify', $_ef = '/Create/Delete/Modify/Import', $_formex = '')
No description
setSignature($_signing_cert = '', $_private_key = '', $_private_key_password = '', $_extracerts = '', $_cert_type = 2, $_info = [], $_approval = '')
No description
setSignatureAppearance($_x = 0, $_y = 0, $_w = 0, $_h = 0, $_page = -1, $_name = '')
No description
addEmptySignatureAppearance($_x = 0, $_y = 0, $_w = 0, $_h = 0, $_page = -1, $_name = '')
No description
setTimeStamp($_tsa_host = '', $_tsa_username = '', $_tsa_password = '', $_tsa_cert = '')
No description
startPageGroup($_page = null)
No description
setStartingPageNumber($_num = 1)
No description
string
getAliasRightShift()
No description
string
getAliasNbPages()
No description
string
getAliasNumPage()
No description
string
getPageGroupAlias()
No description
string
getPageNumGroupAlias()
No description
int
getGroupPageNo()
No description
getGroupPageNoFormatted()
No description
PageNoFormatted()
No description
startLayer($_name = '', $_print = true, $_view = true, $_lock = true)
No description
endLayer()
No description
setVisibility($_v)
No description
setOverprint($_stroking = true, $_nonstroking = null, $_mode = 0)
No description
getOverprint()
No description
setAlpha($_stroking = 1, $_bm = 'Normal', $_nonstroking = null, $_ais = false)
No description
protected void
registerTemplateExtGState(string $cmd)
Register the ExtGState referenced by the given command with the open XObject template resource dictionary.
getAlpha()
No description
setJPEGQuality($_quality)
No description
setDefaultTableColumns($_cols = 4)
No description
setCellHeightRatio($_h)
No description
float
getCellHeightRatio()
No description
setPDFVersion($_version = '1.7')
No description
setViewerPreferences($_preferences)
No description
colorRegistrationBar($_x, $_y, $_w, $_h, $_transition = true, $_vertical = false, $_colors = 'A,R,G,B,C,M,Y,K')
No description
cropMark($_x, $_y, $_w, $_h, $_type = 'T,R,B,L', $_color = [100, 100, 100, 100, 'All'])
No description
registrationMark($_x, $_y, $_r, $_double = false, $_cola = [100, 100, 100, 100, 'All'], $_colb = [0, 0, 0, 0, 'None'])
No description
registrationMarkCMYK($_x, $_y, $_r)
No description
LinearGradient($_x, $_y, $_w, $_h, $_col1 = [], $_col2 = [], $_coords = [0, 0, 1, 0])
No description
RadialGradient($_x, $_y, $_w, $_h, $_col1 = [], $_col2 = [], $_coords = [0.5, 0.5, 0.5, 0.5, 1])
No description
CoonsPatchMesh($_x, $_y, $_w, $_h, $_col1 = [], $_col2 = [], $_col3 = [], $_col4 = [], $_coords = [0.0, 0.0, 0.33, 0.0, 0.67, 0.0, 1.0, 0.0, 1.0, 0.33, 1.0, 0.67, 1.0, 1.0, 0.67, 1.0, 0.33, 1.0, 0.0, 1.0, 0.0, 0.67, 0.0, 0.33], $_coords_min = 0, $_coords_max = 1, $_antialias = false)
No description
protected array
coonsPatchArray(array $patches)
Convert a legacy Coons patch-mesh array (per-patch 'f', 'points', and 'colors' with 0-255 r/g/b keys) to the engine shape (normalized red/green/blue floats).
Gradient($_type, $_coords, $_stops, $_background = [], $_antialias = false)
No description
PieSector($_xc, $_yc, $_r, $_a, $_b, $_style = 'FD', $_cw = true, $_o = 90)
No description
PieSectorXY($_xc, $_yc, $_rx, $_ry, $_a, $_b, $_style = 'FD', $_cw = false, $_o = 0, $_nc = 2)
No description
ImageEps($_file, $_x = null, $_y = null, $_w = 0, $_h = 0, $_link = '', $_useBoundingBox = true, $_align = '', $_palign = '', $_border = 0, $_fitonpage = false, $_fixoutvals = false)
[BREAKING CHANGE] EPS/AI vector import is not supported.
The modern engine has no PostScript interpreter: convert EPS/AI
artwork to SVG (e.g. inkscape file.eps --export-filename=file.svg
or mutool convert) and use ImageSVG() instead. As a convenience,
SVG files passed to this method are dispatched to ImageSVG() and
raster files to Image(); EPS/AI input is silently skipped.
setBarcode($_bc = '')
No description
string
getBarcode()
No description
write1DBarcode($_code, $_type, $_x = null, $_y = null, $_w = null, $_h = null, $_xres = null, $_style = [], $_align = '')
No description
write2DBarcode($_code, $_type, $_x = null, $_y = null, $_w = null, $_h = null, $_style = [], $_align = '', $_distort = false)
No description
protected void
emitBarcode(string $code, string $type, mixed $posx, mixed $posy, mixed $width, mixed $height, float $xres, mixed $style, string $align, bool $is2d, bool $distort = false)
Render a barcode at the given position via the engine.
protected void
drawBarcode1D(string $type, string $code, float $posx, float $posy, mixed $width, mixed $height, float $xres, array $style, string $align, int $maxw, string $fgspec)
Render a 1D barcode with the legacy geometry: bars, the optional human-readable label and the vertical padding all fit inside the requested height (barh = height - text_height - 2*vpadding) instead of the label being appended below it. Bar drawing is delegated to the engine; the box, label and cursor advance mirror write1DBarcode().
protected void
drawBarcode2D(string $type, string $code, float $posx, float $posy, mixed $width, mixed $height, array $style, string $align, int $cols, int $rows, string $fgspec, bool $distort)
Render a 2D barcode with the legacy geometry: the barcode cells are inset inside the requested box by the (auto) padding quiet-zone and the aspect ratio is preserved unless $distort is set. Mirrors write2DBarcode().
protected float
fitBarcodeBlock(float $posx, float $posy, float $boxh)
Move to the next page when a barcode of the given height would not fit below the current Y, preserving the abscissa. Returns the Y to draw at.
protected float
barcodeBoxX(string $position, float $posx, float $boxw)
Left edge of a barcode box for the legacy position keyword (L/C/R or the current abscissa for the empty/default case).
protected string
barcodeBox(float $x, float $y, float $w, float $h, array $style)
Background fill and/or border around a barcode box.
protected void
advanceAfterBarcode(string $align, string $position, float $posx, float $drawy, float $boxw, float $boxh)
Advance the cursor next to a drawn barcode for the legacy $align value.
getMargins()
No description
getOriginalMargins()
No description
float
getFontSize()
No description
float
getFontSizePt()
No description
string
getFontFamily()
No description
string
getFontStyle()
No description
fixHTMLCode($_html, $_default_css = '', $_tagvs = null, $_tidy_options = null)
No description
getCSSPadding($_csspadding, $_width = 0)
No description
getCSSMargin($_cssmargin, $_width = 0)
No description
getCSSBorderMargin($_cssbspace, $_width = 0)
No description
protected array
cssBoxValues(string $css, float $width)
Parse a CSS shorthand box value (top right bottom left) into user units.
getHTMLFontUnits($_val, $_refsize = 12, $_parent_size = 12, $_defaultunit = 'pt')
No description
serializeTCPDFtag($_method, $_params = [])
No description
writeHTMLCell($_w, $_h, $_x, $_y, $_html = '', $_border = 0, $_ln = 0, $_fill = false, $_reseth = true, $_align = '', $_autopadding = true)
No description
protected string
absolutizeMarkupPath(string $source)
Make a relative local markup resource path absolute.
protected string
cssSafeMarkupPath(string $source)
Return a markup resource path that survives CSS lowercasing.
CSS values are lowercased by the engine parser, so paths used in CSS context are copied to a lowercase temporary file when necessary.
protected string
inheritHtmlBackgrounds(string $html)
Flatten styled inline elements that contain nested inline children.
The engine HTML renderer only paints inline backgrounds for fragments whose element sits directly below the block element; nested children (e.g. xy) lose the background. The parent is therefore split into a sequence of sibling elements of the same tag, each carrying the merged style and the original attributes (links keep working, one annotation per piece).
protected string
normalizeHtmlMarkup(string $html)
Adapt legacy-tolerant HTML markup for the stricter engine renderer.
Applied transformations:
- styled inline parents with nested children are flattened so the engine paints their backgrounds (see inheritHtmlBackgrounds());
- vertical align attributes are dropped from images inside tables (the engine would overlap them with the row borders);
- '@'-prefixed base64 image data is rewritten to a data URI;
- relative local image paths are made absolute (src attributes, CSS url() values and the legacy img| list-bullet syntax);
- malformed hexadecimal color tokens, silently coerced by the legacy parser, are repaired to valid values.
protected void
writeHtmlWithTcpdfTags(string $html, mixed $w, mixed $h, mixed $x, mixed $y, mixed $border, mixed $_ln, mixed $fill, mixed $reseth, mixed $align, mixed $autopadding)
Render HTML containing embedded
writeHTML($_html, $_ln = true, $_fill = false, $_reseth = false, $_cell = false, $_align = '')
No description
setLIsymbol($_symbol = '!')
No description
setBooklet($_booklet = true, $_inner = -1, $_outer = -1)
No description
setHtmlVSpace($_tagvs)
No description
setListIndentWidth($_width)
No description
setOpenCell($_isopen)
No description
setHtmlLinksStyle($_color = [0, 0, 255], $_fontstyle = 'U')
No description
getHTMLUnitToUnits($_htmlval, $_refsize = 1, $_defaultunit = 'px', $_points = false)
No description
movePage($_frompage, $_topage)
No description
deletePage($_page)
No description
copyPage($_page = 0)
No description
addTOC($_page = null, $_numbersfont = '', $_filler = '.', $_toc_name = 'TOC', $_style = '', $_color = [0, 0, 0])
No description
addHTMLTOC($_page = null, $_toc_name = 'TOC', $_templates = [], $_correct_align = true, $_style = '', $_color = [0, 0, 0])
No description
startTransaction()
No description
commitTransaction()
No description
rollbackTransaction($_self = false)
No description
protected array
equalColumnRegions(int $numcols, float $width, float $ypos)
Legacy equal-column geometry: the requested width is capped to an even share of the content width and the remainder becomes the inter-column gutters.
protected void
setEnginePageRegions(array $regions)
Replace the region (column) layout of the current engine page.
The engine fixes the region list when a page is created and exposes no mutator: the normalized region data (same normalization as the engine page settings) is written directly into the page store.
protected bool
inColumnMode()
True when the current page is split into multiple column regions.
setEqualColumns($_numcols = 0, $_width = 0, $_y = null)
No description
resetColumns()
No description
setColumnsArray($_columns)
No description
selectColumn($_col = null)
No description
getColumn()
No description
getNumberOfColumns()
No description
setTextRenderingMode($_stroke = 0, $_fill = true, $_clip = false)
No description
setTextShadow($_params = ['enabled' => false, 'depth_w' => 0, 'depth_h' => 0, 'color' => false, 'opacity' => 1, 'blend_mode' => 'Normal'])
No description
array{enabled: bool, depth_w: int|float, depth_h: int|float, color: mixed, opacity: int|float, blend_mode: string}
getTextShadow()
No description
hyphenateText($_text, $_patterns, $_dictionary = [], $_leftmin = 1, $_rightmin = 2, $_charmin = 1, $_charmax = 8)
No description
setRasterizeVectorImages($_mode)
No description
setFontSubsetting($_enable = true)
No description
bool
getFontSubsetting()
No description
stringLeftTrim($_str, $_replace = '')
No description
stringRightTrim($_str, $_replace = '')
No description
stringTrim($_str, $_replace = '')
No description
isUnicodeFont()
No description
getFontFamilyName($_fontfamily)
No description
startTemplate($_w = 0, $_h = 0, $_group = false)
No description
endTemplate()
No description
printTemplate($_id, $_x = null, $_y = null, $_w = 0, $_h = 0, $_align = '', $_palign = '', $_fitonpage = false)
No description
setFontStretching($_perc = 100)
No description
float
getFontStretching()
No description
setFontSpacing($_spacing = 0)
No description
float
getFontSpacing()
No description
getPageRegions()
No description
setPageRegions($_regions = [])
No description
addPageRegion($_region)
No description
removePageRegion($_key)
No description
protected array
currentPageNoWriteAreas()
The legacy no-write areas registered for the current page, in the engine setNoWriteRegions() input format (xt/yt/xb/yb/side).
No-write regions only apply to flowing body content; the header/footer decoration (drawn in a late pass with the page context restored, when a page's regions may already be set) must keep its own layout, so report none while rendering it — matching legacy, whose header sits above the content area the regions live in.
protected bool
applyNoWriteRegionsForFlow(float $bandheight, float $cursory)
(Re)build the engine banded writable regions for the current page from its legacy no-write areas, using $bandheight as the height of each horizontal slice, then select the region that contains the current Y so the flow starts at the cursor and hugs the obstacles band by band. The text/HTML engine then advances region -> region -> fresh full-width page on its own.
protected void
selectRegionAtY(float $y)
Select the (top-to-bottom ordered) writable region of the current page whose vertical span contains $y, so a flow that starts at the cursor begins in the right band. Falls back to the first region when $y sits above them all.
protected float
noWriteBandFromHtml(string $html)
Band height (one writable slice) for a no-write region flow of HTML: the cell height of the body (outermost) font size declared in the fragment, falling back to the current font. A slice should be about one body line tall so the bands hug the obstacle without wasting vertical space (which would push too much text onto the continuation page); larger inline runs sit in the tall merged region at the top rather than at a band boundary.
ImageSVG($_file, $_x = null, $_y = null, $_w = 0, $_h = 0, $_link = '', $_align = '', $_palign = '', $_border = 0, $_fitonpage = false)
No description