SVG

SVG PDF class

Namespace: Com\Tecnick\Pdf

Extends: Text

Abstract: Yes

File: SVG.php line 453

SVG 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: TTMatrix from \Com\Tecnick\Pdf\Graph\Base
  • phpstan-import-type: TRefUnitValues from \Com\Tecnick\Pdf\Base
  • phpstan-type: TSVGSize array{ ‘x’: float, ‘y’: float, ‘width’: float, ‘height’: float, ‘viewBox’: array{ float, float, float, float }, ‘ar_align’: string, ‘ar_ms’: string, }
  • phpstan-type: TSVGCoord array{ ‘x’: float, ‘y’: float, ‘x0’: float, ‘y0’: float, ‘xmin’: float, ‘xmax’: float, ‘ymin’: float, ‘ymax’: float, ‘xinit’: float, ‘yinit’: float, ‘xoffset’: float, ‘yoffset’: float, ‘relcoord’: bool, ‘firstcmd’: bool, ‘cpx’: float, ‘cpy’: float, ‘cptype’: string, }
  • phpstan-type: TSVGGradient array{ ‘xref’: string, ’type’: int, ‘gradientUnits’: string, ‘mode’: string, ‘coords’: array, ‘stops’: array<int, array{ ‘color’: string, ’exponent’?: float, ‘opacity’?: float, ‘offset’?: float, }>, ‘gradientTransform’: array, }
  • phpstan-type: TSVGStyle array{ ‘alignment-baseline’: string, ‘baseline-shift’: string, ‘clip’: string, ‘clip-path’: string, ‘clip-rule’: string, ‘color’: string, ‘color-interpolation’: string, ‘color-interpolation-filters’: string, ‘color-profile’: string, ‘color-rendering’: string, ‘cursor’: string, ‘direction’: string, ‘display’: string, ‘dominant-baseline’: string, ’enable-background’: string, ‘fill’: string, ‘fill-opacity’: float, ‘fill-rule’: string, ‘filter’: string, ‘flood-color’: string, ‘flood-opacity’: float, ‘font’: string, ‘font-family’: string, ‘font-size’: string, ‘font-size-val’: float, ‘font-size-adjust’: string, ‘font-stretch’: string, ‘font-stretch-val’: float, ‘font-style’: string, ‘font-variant’: string, ‘font-weight’: string, ‘font-mode’: string, ‘glyph-orientation-horizontal’: string, ‘glyph-orientation-vertical’: string, ‘image-rendering’: string, ‘kerning’: string, ’letter-spacing’: string, ’letter-spacing-val’: float, ’lighting-color’: string, ‘marker’: string, ‘marker-end’: string, ‘marker-mid’: string, ‘marker-start’: string, ‘mask’: string, ‘mix-blend-mode’: string, ‘objstyle’: string, ‘opacity’: float, ‘overflow’: string, ‘pointer-events’: string, ‘shape-rendering’: string, ‘stop-color’: string, ‘stop-opacity’: float, ‘stroke’: string, ‘stroke-dasharray’: string, ‘stroke-dashoffset’: float, ‘stroke-linecap’: string, ‘stroke-linejoin’: string, ‘stroke-miterlimit’: float, ‘stroke-opacity’: float, ‘stroke-width’: float, ’text-anchor’: string, ’text-decoration’: string, ’text-rendering’: string, ‘unicode-bidi’: string, ‘visibility’: string, ‘word-spacing’: string, ‘writing-mode’: string, ’text-color’: string, ’transfmatrix’: TTMatrix, }
  • phpstan-type: TSVGTextMode array{ ‘rtl’: bool, ‘invisible’: bool, ‘stroke’: int, ’text-anchor’: string, ‘spacepreserve’?: bool, ’textstarted’?: bool, ‘vertical’?: bool, ’linkhref’?: string, ’linkx’?: float, ’linky’?: float, ‘baseline’?: string, ‘rotate’?: float, ’textlength’?: float, ’lengthadjust’?: string, ‘xlist’?: array<int, float>, ‘ylist’?: array<int, float>, ‘rotlist’?: array<int, float>, ’textpathpoints’?: array<int, array{ 0: float, 1: float }>, ’textpathoffset’?: float, ’textpathmethod’?: string, ’textpathspacing’?: string, }
  • phpstan-type: TSVGAttributes array{ ‘accumulate’?: string, ‘additive’?: string, ‘alignment-baseline’?: string, ‘amplitude’?: string, ‘attributeName’?: string, ‘attributeType’?: string, ‘azimuth’?: string, ‘baseFrequency’?: string, ‘baseProfile’?: string, ‘baseline-shift’?: string, ‘begin’?: string, ‘bias’?: string, ‘by’?: string, ‘calcMode’?: string, ‘class’?: string, ‘clip’?: string, ‘clip-path’?: string, ‘clip-rule’?: string, ‘clipPathUnits’?: string, ‘closing_tag’?: bool, ‘color’?: string, ‘color-interpolation’?: string, ‘color-interpolation-filters’?: string, ‘content’?: string, ‘crossorigin’?: string, ‘cursor’?: string, ‘cx’?: string, ‘cy’?: string, ’d’?: string, ‘data-*’?: string, ‘decoding’?: string, ‘diffuseConstant’?: string, ‘direction’?: string, ‘display’?: string, ‘divisor’?: string, ‘dominant-baseline’?: string, ‘dur’?: string, ‘dx’?: string, ‘dy’?: string, ’edgeMode’?: string, ’elevation’?: string, ’end’?: string, ’exponent’?: string, ‘fill’?: string, ‘fill-opacity’?: string, ‘fill-rule’?: string, ‘filter’?: string, ‘filterUnits’?: string, ‘flood-color’?: string, ‘flood-opacity’?: string, ‘font-family’?: string, ‘font-size’?: string, ‘font-size-adjust’?: string, ‘font-stretch’?: string, ‘font-style’?: string, ‘font-variant’?: string, ‘font-weight’?: string, ‘fr’?: string, ‘from’?: string, ‘fx’?: string, ‘fy’?: string, ‘glyph-orientation-horizontal’?: string, ‘glyph-orientation-vertical’?: string, ‘gradientTransform’?: string, ‘gradientUnits’?: string, ‘height’?: string, ‘href’?: string, ‘hreflang’?: string, ‘id’?: string, ‘image-rendering’?: string, ‘in’?: string, ‘in2’?: string, ‘intercept’?: string, ‘k1’?: string, ‘k2’?: string, ‘k3’?: string, ‘k4’?: string, ‘kernelMatrix’?: string, ‘kernelUnitLength’?: string, ‘keyPoints’?: string, ‘keySplines’?: string, ‘keyTimes’?: string, ’lang’?: string, ’lengthAdjust’?: string, ’letter-spacing’?: string, ’lighting-color’?: string, ’limitingConeAngle’?: string, ’local’?: string, ‘marker-end’?: string, ‘marker-mid’?: string, ‘marker-start’?: string, ‘markerHeight’?: string, ‘markerUnits’?: string, ‘markerWidth’?: string, ‘mask’?: string, ‘maskContentUnits’?: string, ‘maskUnits’?: string, ‘max’?: string, ‘media’?: string, ‘method’?: string, ‘min’?: string, ‘mode’?: string, ’numOctaves’?: string, ‘offset’?: string, ‘opacity’?: string, ‘operator’?: string, ‘order’?: string, ‘orient’?: string, ‘origin’?: string, ‘overflow’?: string, ‘paint-order’?: string, ‘path’?: string, ‘pathLength’?: string, ‘patternContentUnits’?: string, ‘patternTransform’?: string, ‘patternUnits’?: string, ‘ping’?: string, ‘pointer-events’?: string, ‘points’?: string, ‘pointsAtX’?: string, ‘pointsAtY’?: string, ‘pointsAtZ’?: string, ‘preserveAlpha’?: string, ‘preserveAspectRatio’?: string, ‘primitiveUnits’?: string, ‘r’?: string, ‘radius’?: string, ‘refX’?: string, ‘refY’?: string, ‘referrerPolicy’?: string, ‘rel’?: string, ‘rendering-intent’?: string, ‘repeatCount’?: string, ‘repeatDur’?: string, ‘requiredExtensions’?: string, ‘requiredFeatures’?: string, ‘restart’?: string, ‘result’?: string, ‘rotate’?: string, ‘rx’?: string, ‘ry’?: string, ‘scale’?: string, ‘seed’?: string, ‘shape-rendering’?: string, ‘side’?: string, ‘slope’?: string, ‘spacing’?: string, ‘specularConstant’?: string, ‘specularExponent’?: string, ‘speed’?: string, ‘spreadMethod’?: string, ‘startOffset’?: string, ‘stdDeviation’?: string, ‘stitchTiles’?: string, ‘stop-color’?: string, ‘stop-opacity’?: string, ‘stroke’?: string, ‘stroke-dasharray’?: string, ‘stroke-dashoffset’?: string, ‘stroke-linecap’?: string, ‘stroke-linejoin’?: string, ‘stroke-miterlimit’?: string, ‘stroke-opacity’?: string, ‘stroke-width’?: string, ‘style’?: string, ‘surfaceScale’?: string, ‘systemLanguage’?: string, ’tabindex’?: string, ’tableValues’?: string, ’target’?: string, ’targetX’?: string, ’targetY’?: string, ’text-anchor’?: string, ’text-decoration’?: string, ’text-rendering’?: string, ’textLength’?: string, ’to’?: string, ’transform’?: string, ’transform-origin’?: string, ’type’?: string, ‘unicode-bidi’?: string, ‘values’?: string, ‘vector-effect’?: string, ‘version’?: string, ‘viewBox’?: string, ‘visibility’?: string, ‘width’?: string, ‘word-spacing’?: string, ‘writing-mode’?: string, ‘x’?: string, ‘x1’?: string, ‘x2’?: string, ‘xChannelSelector’?: string, ‘xlink:actuate’?: string, ‘xlink:arcrole’?: string, ‘xlink:href Deprecated’?: string, ‘xlink:href’?: string, ‘xlink:role’?: string, ‘xlink:show’?: string, ‘xlink:title’?: string, ‘xlink:type’?: string, ‘xml:lang’?: string, ‘xml:space’?: string, ‘y’?: string, ‘y1’?: string, ‘y2’?: string, ‘yChannelSelector’?: string, ‘z’?: string, ‘zoomAndPan’?: string, }
  • phpstan-type: TSVGAttribChild array{ ’name’: string, ‘attr’: TSVGAttributes, }
  • phpstan-type: TSVGAttribs array{ ’name’: string, ‘attr’: TSVGAttributes, ’tm’?: TTMatrix, ‘child’?: array<string, TSVGAttribChild>, }
  • phpstan-type: TSVGSwitchState array{ ‘depth’: int, ‘selected’: bool, ‘skipdepth’: int, }
  • phpstan-type: TSVGObj array{ ‘defsmode’: bool, ‘clipmode’: bool, ‘clipid’: int|string, ’tagdepth’: int, ‘x0’: float, ‘y0’: float, ‘x’: float, ‘y’: float, ‘refunitval’: TRefUnitValues, ‘gradientid’: string, ‘gradients’: array<string, TSVGGradient>, ‘clippaths’: array<string, TSVGAttribs>, ‘defs’: array<string, TSVGAttribs>, ‘cliptm’: TTMatrix, ‘styles’: array<int, TSVGStyle>, ‘child’: array, ‘xmldepth’: int, ‘switchstack’?: array<int, TSVGSwitchState>, ‘usechain’: array<string, bool>, ‘markermode’: int, ‘patternmode’: int, ’textmode’: TSVGTextMode, ‘charskip’: int, ’textdepth’: int, ’text’: string, ‘markupresources’: bool, ‘dir’: string, ‘out’: string, }
  • 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

addPage()

File: Text.php line 3628

public addPage([PageInputData $data = [] ]) : PageData

Parameters

  • $data : PageInputData = []: Page data.

Tags

  • throws: Exception
  • throws: Exception
  • throws: Exception

Return values

PageData —

Page data with additional Page ID property ‘pid’.

addSVG()

File: SVG.php line 8428

public addSVG(string $img[, float $posx = 0.0 ][, float $posy = 0.0 ][, float $width = 0.0 ][, float $height = 0.0 ][, float $pageheight = 0.0 ][, bool $useMarkupResources = false ]) : int

Parameters

  • $img : string: The path to the SVG file, or the SVG image data prefixed with ‘@’.
  • $posx : float = 0.0: X position in user units.
  • $posy : float = 0.0: Y position in user units.
  • $width : float = 0.0: Width in user units.
  • $height : float = 0.0: Height in user units.
  • $pageheight : float = 0.0: Page height in user units.
  • $useMarkupResources : bool = false

Tags

  • throws: Exception If SVG data is invalid or parsing fails.
  • throws: Exception If the SVG file cannot be read.
  • throws: Exception If page dimensions cannot be read.

Return values

int —

The SVG object ID.

addTaggedFigureContent()

File: Text.php line 963

public addTaggedFigureContent(string $content, int $pid[, string $alt = '' ][, TFourFloat|array{} $bbox = [] ]) : void

Pass raw drawing/image operators (for example from graph or image helpers) to associate them with a Figure structure element and optional /Alt text.

Parameters

  • $content : string: Raw drawing/image operators to place inside the Figure.
  • $pid : int: Page identifier the content is added to.
  • $alt : string = ‘’: Optional alternate text written as the Figure /Alt entry.
  • $bbox : TFourFloat|array{} = []: Optional bounding box of the content as [llx, lly, urx, ury] in points, measured in default user space with the origin at the bottom-left page corner. Written as the /BBox Layout attribute, which PDF/UA requires for figures contained on a single page.

Tags

  • throws: Exception

addTextCell()

File: Text.php line 540

public addTextCell(string $txt[, int $pid = -1 ][, float $posx = 0 ][, float $posy = 0 ][, float $width = 0 ][, float $height = 0 ][, float $offset = 0 ][, float $linespace = 0 ][, string|TextVAlign $valign = 'T' ][, string|TextHAlign $halign = '' ][, TCellDef|null $cell = null ][, TextCellStylesInput $styles = [] ][, float $strokewidth = 0 ][, float $wordspacing = 0 ][, float $leading = 0 ][, float $rise = 0 ][, bool $jlast = true ][, bool $fill = true ][, bool $stroke = false ][, bool $underline = false ][, bool $linethrough = false ][, bool $overline = false ][, bool $clip = false ][, bool $drawcell = true ][, string|TextDirection $forcedir = '' ][, TextShadow|null $shadow = null ][, string|TextFitMode $fit = '' ]) : void

Accounts for automatic line, page and region breaks.

Parameters

  • $txt : string: Text string to be processed.
  • $pid : int = -1: Page index. Omit or set it to -1 for the current page ID.
  • $posx : float = 0: Abscissa of upper-left corner relative to the region origin X coordinate.
  • $posy : float = 0: Ordinate of upper-left corner relative to the region origin Y coordinate.
  • $width : float = 0: Width.
  • $height : float = 0: Height.
  • $offset : float = 0: Horizontal offset to apply to the line start.
  • $linespace : float = 0: Additional space to add between lines.
  • $valign : string|TextVAlign = ‘T’: Text vertical alignment inside the cell: T=top; C=center; B=bottom (or enum case).
  • $halign : string|TextHAlign = ‘’: Text horizontal alignment inside the cell: L=left; C=center; R=right; J=justify (or enum).
  • $cell : TCellDef|null = null: Optional to overwrite cell parameters for padding, margin etc. The margin and padding values are in points.
  • $styles : TextCellStylesInput = []: Cell border styles (see: getCurrentStyleArray).
  • $strokewidth : float = 0: Stroke width.
  • $wordspacing : float = 0: Word spacing (use it only when justify == false).
  • $leading : float = 0: Leading.
  • $rise : float = 0: Text rise.
  • $jlast : bool = true: If true does not justify the last line when $halign == J.
  • $fill : bool = true: If true fills the text.
  • $stroke : bool = false: If true stroke the text.
  • $underline : bool = false: If true underline the text.
  • $linethrough : bool = false: If true line through the text.
  • $overline : bool = false: If true overline the text.
  • $clip : bool = false: If true activate clipping mode.
  • $drawcell : bool = true: If true draw the cell border.
  • $forcedir : string|TextDirection = ‘’: If ‘R’ forces RTL, if ‘L’ forces LTR.
  • $shadow : TextShadow|null = null: Text shadow parameters.
  • $fit : string|TextFitMode = ‘’: Option to fit the overflowing text in the given cell dimensions (or enum case). Supported values: - ‘’: disabled (default) - ‘T’: truncate text to fit width and height - ‘S’: compress horizontally to best fit width - ‘F’: decrease font size only when text is too large

Tags

  • throws: Exception
  • throws: Exception
  • throws: Exception

addTextCellXY()

File: Text.php line 433

public addTextCellXY(string $txt[, int $pid = -1 ][, float $posx = 0 ][, float $posy = 0 ][, float $width = 0 ][, float $height = 0 ][, float $offset = 0 ][, float $linespace = 0 ][, string|TextVAlign $valign = 'T' ][, string|TextHAlign $halign = '' ][, TCellDef|null $cell = null ][, TextCellStylesInput $styles = [] ][, float $strokewidth = 0 ][, float $wordspacing = 0 ][, float $leading = 0 ][, float $rise = 0 ][, bool $jlast = true ][, bool $fill = true ][, bool $stroke = false ][, bool $underline = false ][, bool $linethrough = false ][, bool $overline = false ][, bool $clip = false ][, bool $drawcell = true ][, string|TextDirection $forcedir = '' ][, TextShadow|null $shadow = null ][, string|TextFitMode $fit = '' ]) : void

Accounts for automatic line, page and region breaks.

Parameters

  • $txt : string: Text string to be processed.
  • $pid : int = -1: Page index. Omit or set it to -1 for the current page ID.
  • $posx : float = 0: Abscissa of upper-left corner.
  • $posy : float = 0: Ordinate of upper-left corner.
  • $width : float = 0: Width.
  • $height : float = 0: Height.
  • $offset : float = 0: Horizontal offset to apply to the line start.
  • $linespace : float = 0: Additional space to add between lines.
  • $valign : string|TextVAlign = ‘T’: Text vertical alignment inside the cell: T=top; C=center; B=bottom (or enum case).
  • $halign : string|TextHAlign = ‘’: Text horizontal alignment inside the cell: L=left; C=center; R=right; J=justify (or enum).
  • $cell : TCellDef|null = null: Optional to overwrite cell parameters for padding, margin etc. The margin and padding values are in points.
  • $styles : TextCellStylesInput = []: Cell border styles (see: getCurrentStyleArray).
  • $strokewidth : float = 0: Stroke width.
  • $wordspacing : float = 0: Word spacing (use it only when justify == false).
  • $leading : float = 0: Leading.
  • $rise : float = 0: Text rise.
  • $jlast : bool = true: If true does not justify the last line when $halign == J.
  • $fill : bool = true: If true fills the text.
  • $stroke : bool = false: If true stroke the text.
  • $underline : bool = false: If true underline the text.
  • $linethrough : bool = false: If true line through the text.
  • $overline : bool = false: If true overline the text.
  • $clip : bool = false: If true activate clipping mode.
  • $drawcell : bool = true: If true draw the cell border.
  • $forcedir : string|TextDirection = ‘’: If ‘R’ forces RTL, if ‘L’ forces LTR.
  • $shadow : TextShadow|null = null: Text shadow parameters.
  • $fit : string|TextFitMode = ‘’: Option to fit the overflowing text in the given cell dimensions (or enum case). Supported values: - ‘’: disabled (default) - ‘T’: truncate text to fit width and height - ‘S’: compress horizontally to best fit width - ‘F’: decrease font size only when text is too large

Tags

  • throws: Exception
  • throws: Exception
  • throws: Exception

beginArtifact()

File: Text.php line 984

public beginArtifact([string $type = '' ][, string $subtype = '' ]) : string

Typical usage is for repeated page furniture (header/footer/page numbers), decorative graphics, separators, and similar visual-only content. This method returns the opening PDF operators and does not write them to the current page automatically. To persist the artifact block, append the returned string with page->addContent(…) or use addArtifactContent().

Parameters

  • $type : string = ‘’: Optional Artifact /Type name (for example ‘Pagination’).
  • $subtype : string = ‘’: Optional Artifact /Subtype name (for example ‘Header’ or ‘Footer’).

Return values

string

beginStructElem()

File: Text.php line 871

public beginStructElem(string $role, int $pid[, string|null $alt = null ][, array<string, string> $attr = [] ][, bool $required = false ]) : void

Call this before rendering the content of a logical block (e.g.

,

). All addTextCell calls until endStructElem() share the same structure element.

Parameters

  • $role : string: PDF structure role, e.g. ‘P’, ‘H1’, ‘H2’, ‘L’, ‘LI’, ‘Figure’.
  • $pid : int: Page index (from addPage / getPageId).
  • $alt : string|null = null: Optional alternate description written as /Alt in the structure element dictionary, typically alt-text for Figure elements.
  • $attr : array<string, string> = []: Optional structure element attributes, serialized as a PDF dictionary in the /A entry.
  • $required : bool = false: When true, the element is kept in the structure tree even if it receives no marked content (e.g. an empty table cell).

defaultFileAllowedPaths()

File: Base.php line 1645

public defaultFileAllowedPaths() : array<string|int, string>

Return values

array<string|int, string>

defaultMarkupAllowedPaths()

File: Base.php line 1655

public defaultMarkupAllowedPaths() : array<string|int, string>

Return values

array<string|int, string>

defaultPageContent()

File: Text.php line 3706

public defaultPageContent([int $pid = -1 ]) : string

Override this method to add custom content to all pages.

Parameters

  • $pid : int = -1: Page index. Omit or set it to -1 for the current page ID.

Tags

  • throws: Exception
  • throws: Exception
  • throws: Exception

Return values

string —

PDF output code.

enableDefaultPageContent()

File: Base.php line 1514

public enableDefaultPageContent([bool $enable = true ]) : void

Parameters

  • $enable : bool = true: Enable or disable the default page content.

enableZeroWidthBreakPoints()

File: Text.php line 3498

public enableZeroWidthBreakPoints(bool $enabled) : void

Parameters

  • $enabled : bool

endArtifact()

File: Text.php line 1014

public endArtifact() : string

Like beginArtifact(), this returns raw PDF operators and must be appended to the page content explicitly when using the low-level API.

Return values

string

endStructElem()

File: Text.php line 908

public endStructElem() : void

The completed element (with all its MCIDs) is appended to the struct log.

getLastBBox()

File: Text.php line 2926

public getLastBBox() : TBBox

Return values

TBBox —

Array of bounding box values.

getLastCellBBox()

File: Text.php line 2962

public getLastCellBBox() : TBBox

Return values

TBBox —

Array of bounding box values.

getLastTextBBox()

File: Text.php line 2944

public getLastTextBBox() : TBBox

Return values

TBBox —

Array of bounding box values.

getSetSVG()

File: SVG.php line 8609

public getSetSVG(int $soid) : string

Parameters

  • $soid : int: SVG Object ID (as returned by addSVG).

Tags

  • throws: Exception If the SVG object ID is unknown.

Return values

string —

Image PDF page content.

getTextCell()

File: Text.php line 230

public getTextCell(string $txt[, float $posx = 0 ][, float $posy = 0 ][, float $width = 0 ][, float $height = 0 ][, float $offset = 0 ][, float $linespace = 0 ][, string|TextVAlign $valign = 'C' ][, string|TextHAlign $halign = 'C' ][, TCellDef|null $cell = null ][, TextCellStylesInput $styles = [] ][, float $strokewidth = 0 ][, float $wordspacing = 0 ][, float $leading = 0 ][, float $rise = 0 ][, bool $jlast = true ][, bool $fill = true ][, bool $stroke = false ][, bool $underline = false ][, bool $linethrough = false ][, bool $overline = false ][, bool $clip = false ][, bool $drawcell = true ][, string|TextDirection $forcedir = '' ][, TextShadow|null $shadow = null ][, string|TextFitMode $fit = '' ]) : string

Parameters

  • $txt : string: Text string to be processed.
  • $posx : float = 0: Abscissa of upper-left corner.
  • $posy : float = 0: Ordinate of upper-left corner.
  • $width : float = 0: Width.
  • $height : float = 0: Height.
  • $offset : float = 0: Horizontal offset to apply to the line start.
  • $linespace : float = 0: Additional space to add between lines.
  • $valign : string|TextVAlign = ‘C’: Text vertical alignment inside the cell: T=top; C=center; B=bottom (or enum case).
  • $halign : string|TextHAlign = ‘C’: Text horizontal alignment inside the cell: L=left; C=center; R=right; J=justify (or enum).
  • $cell : TCellDef|null = null: Optional to overwrite cell parameters for padding, margin etc. The margin and padding values are in points.
  • $styles : TextCellStylesInput = []: Cell border styles (see: getCurrentStyleArray).
  • $strokewidth : float = 0: Stroke width.
  • $wordspacing : float = 0: Word spacing (use it only when justify == false).
  • $leading : float = 0: Leading.
  • $rise : float = 0: Text rise.
  • $jlast : bool = true: If true does not justify the last line when $halign == J.
  • $fill : bool = true: If true fills the text.
  • $stroke : bool = false: If true stroke the text.
  • $underline : bool = false: If true underline the text.
  • $linethrough : bool = false: If true line through the text.
  • $overline : bool = false: If true overline the text.
  • $clip : bool = false: If true activate clipping mode.
  • $drawcell : bool = true: If true draw the cell border.
  • $forcedir : string|TextDirection = ‘’: If ‘R’ forces RTL, if ‘L’ forces LTR.
  • $shadow : TextShadow|null = null: Text shadow parameters.
  • $fit : string|TextFitMode = ‘’: Option to fit the overflowing text in the given cell dimensions (or enum case). Supported values: - ‘’: disabled (default) - ‘T’: truncate text to fit width and height - ‘S’: compress horizontally to best fit width - ‘F’: decrease font size only when text is too large

Tags

  • throws: Exception
  • throws: Exception
  • throws: Exception

Return values

string

getTextLine()

File: Text.php line 2275

public getTextLine(string $txt[, float $posx = 0 ][, float $posy = 0 ][, float $width = 0 ][, float $strokewidth = 0 ][, float $wordspacing = 0 ][, float $leading = 0 ][, float $rise = 0 ][, bool $fill = true ][, bool $stroke = false ][, bool $underline = false ][, bool $linethrough = false ][, bool $overline = false ][, bool $clip = false ][, string|TextDirection $forcedir = '' ][, string $txtanchor = '' ][, TextShadow|null $shadow = null ]) : string

Parameters

  • $txt : string: Text string to be processed.
  • $posx : float = 0: X position relative to the start of the current line.
  • $posy : float = 0: Y position relative to the start of the current line (font baseline).
  • $width : float = 0: Desired string width to force justification via word spacing (0 = automatic).
  • $strokewidth : float = 0: Stroke width.
  • $wordspacing : float = 0: Word spacing (use it only when width == 0).
  • $leading : float = 0: Leading.
  • $rise : float = 0: Text rise.
  • $fill : bool = true: If true fills the text.
  • $stroke : bool = false: If true stroke the text.
  • $underline : bool = false: If true underline the text.
  • $linethrough : bool = false: If true line through the text.
  • $overline : bool = false: If true overline the text.
  • $clip : bool = false: If true activate clipping mode.
  • $forcedir : string|TextDirection = ‘’: If ‘R’ forces RTL, if ‘L’ forces LTR.
  • $txtanchor : string = ‘’: Text anchor position: ‘S’=start (default), ‘M’=middle, ‘E’=end.
  • $shadow : TextShadow|null = null: Text shadow parameters.

Tags

  • throws: Exception
  • throws: Exception
  • throws: Exception

Return values

string

getWarnings()

File: Base.php line 1860

public getWarnings() : array<int, string>

The list is filled while the content is written and while the document is serialized, so it is complete only after getOutPDFString() has been called.

Return values

array<int, string>

initClassObjects()

File: Base.php line 2065

public initClassObjects([Encrypt|null $objEncrypt = null ][, TFileOptions|null $fileOptions = null ][, CacheInterface|null $cache = null ]) : void

Parameters

  • $objEncrypt : Encrypt|null = null: Encryption object.
  • $fileOptions : TFileOptions|null = null: Optional configuration for the shared file helper used to load external resources (images, fonts, SVG, etc.). Supported keys: - allowedHosts (string[]): Whitelist of host names that the library is allowed to fetch over HTTP/HTTPS. For security reasons remote URL loading is DISABLED by default; you MUST populate this list (for example [’example.com’, ‘cdn.example.com’]) to enable any remote download. Local file reads are controlled separately by allowedPaths. - maxRemoteSize (int): Maximum size in bytes accepted for a remote download (default 52428800 = 50 MiB). - curlopts (array<int,bool|int|string>): Per-request cURL options merged on top of the defaults (keys are CURLOPT_* constants). - defaultCurlOpts (array<int,bool|int|string>): Replaces the built-in default cURL options. Use with care; omit to keep the safe defaults. - fixedCurlOpts (array<int,bool|int|string>): cURL options that are always enforced and cannot be overridden by curlopts (for example to pin TLS settings). - allowedPaths (string[]): Trusted local path prefixes for file:// reads. Defaults are automatically computed from the package location to cover bundled example assets. - markupAllowedPaths (string[]): Trusted local path prefixes for resources referenced by rendered HTML/CSS/SVG markup. Defaults exclude the system temp directory; when omitted, explicit allowedPaths values are reused for markup too.
  • $cache : CacheInterface|null = null: Optional external cache shared by the cacheable sub-libraries (font subsets, images, …). The application owns the backend, its (de)serialization, expiration and size limits. Null (default) disables external caching.

Tags

  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception
  • throws: Exception

loadTexHyphenPatterns()

File: Text.php line 3374

public loadTexHyphenPatterns(string $file) : array<string, string>

Parameters

Tags

Return values

array<string, string> —

Array of hyphenation patterns.

resumePdfUaTagging()

File: Text.php line 849

public resumePdfUaTagging(string $previous) : void

Parameters

  • $previous : string

setCurrentPage()

File: Text.php line 3648

public setCurrentPage([int $pid = -1 ]) : PageData

Parameters

  • $pid : int = -1: page index. Omit or set it to -1 for the current page ID.

Tags

  • throws: Exception

Return values

PageData —

Page data.

setDefaultCellBorderPos()

File: Cell.php line 131

public setDefaultCellBorderPos(float $borderpos) : void

Parameters

  • $borderpos : float: The border position to set: BORDERPOS_DEFAULT BORDERPOS_EXTERNAL BORDERPOS_INTERNAL

setDefaultCellMargin()

File: Cell.php line 96

public setDefaultCellMargin(float $top, float $right, float $bottom, float $left) : void

The values are converted and stored in internal points, so the margin of a cell definition array passed to the text methods must be already in points.

Parameters

  • $top : float: Top.
  • $right : float: Right.
  • $bottom : float: Bottom.
  • $left : float: Left.

setDefaultCellPadding()

File: Cell.php line 115

public setDefaultCellPadding(float $top, float $right, float $bottom, float $left) : void

The values are converted and stored in internal points, so the padding of a cell definition array passed to the text methods must be already in points.

Parameters

  • $top : float: Top.
  • $right : float: Right.
  • $bottom : float: Bottom.
  • $left : float: Left.

File: SVG.php line 468

public abstract setLink(float $posx, float $posy, float $width, float $height, string $link) : int

Implemented by descendants that provide annotation/link support.

Parameters

  • $posx : float: Abscissa of upper-left corner.
  • $posy : float: Ordinate of upper-left corner.
  • $width : float: Link width.
  • $height : float: Link height.
  • $link : string: External URL or internal link identifier.

Return values

int —

Annotation object ID.

setPDFVersion()

File: Base.php line 1969

public setPDFVersion([string $version = '1.7' ]) : static

Parameters

  • $version : string = ‘1.7’: PDF document version.

Tags

Return values

static

setRTL()

File: Base.php line 1624

public setRTL(bool $enabled) : static

Parameters

  • $enabled : bool: False = LTR = Left-To-Right; True = RTL = Right-To-Left.

Return values

static

setTexHyphenPatterns()

File: Text.php line 3427

public setTexHyphenPatterns(array<string, string> $patterns) : void

Parameters

  • $patterns : array<string, string>: Array of hyphenation patterns.

Tags

  • see: loadTexHyphenPatterns()

suspendPdfUaTagging()

File: Text.php line 838

public suspendPdfUaTagging() : string

While suspended, beginStructElem()/endStructElem() and the marked-content helpers are no-ops, so no structure elements are appended and the per-page MCID counter does not advance.

Returns the previous mode, to be passed back to resumePdfUaTagging(). Suspensions nest.

Return values

string

toPoints()

File: Base.php line 1454

public toPoints(float $usr) : float

Parameters

  • $usr : float: Value to convert.

Return values

float

toUnit()

File: Base.php line 1464

public toUnit(float $pnt) : float

Parameters

  • $pnt : float: Value to convert in user units.

Return values

float

toYPoints()

File: Base.php line 1478

public toYPoints(float $usr[, float $pageh = -1 ]) : float

Note: the internal Y points coordinate starts at the bottom left of the page.

Parameters

  • $usr : float: Value to convert.
  • $pageh : float = -1: Optional page height in internal points ($pageh:$this->page->getPage()[‘pheight’]).

Tags

  • throws: Exception

Return values

float

toYUnit()

File: Base.php line 1497

public toYUnit(float $pnt[, float $pageh = -1 ]) : float

Note: the internal Y points coordinate starts at the bottom left of the page.

Parameters

  • $pnt : float: Value to convert.
  • $pageh : float = -1: Optional page height in internal points ($pageh:$this->page->getPage()[‘pheight’]).

Tags

  • throws: Exception

Return values

float