Table of contents
Namespace: Com\Tecnick\Pdf
abstract class SVG extends Text
Extends: Text
Source: src/SVG.php:471
SVG PDF class
Types
TSVGSize
array{
'x': float,
'y': float,
'width': float,
'height': float,
'viewBox': array{
float,
float,
float,
float
},
'ar_align': string,
'ar_ms': string,
}
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,
}
TSVGGradient
array{
'xref': string,
'type': int,
'gradientUnits': string,
'mode': string,
'coords': array<float>,
'stops': array<int, array{
'color': string,
'exponent'?: float,
'opacity'?: float,
'offset'?: float,
}>,
'gradientTransform': array<float>,
}
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': string|float,
'stroke-linecap': string,
'stroke-linejoin': string,
'stroke-miterlimit': float,
'stroke-opacity': float,
'stroke-width': string|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,
}
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,
}
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,
}
TSVGAttribChild
array{
'name': string,
'attr': TSVGAttributes,
}
TSVGAttribs
array{
'name': string,
'attr': TSVGAttributes,
'tm'?: TTMatrix,
'child'?: array<string, TSVGAttribChild>,
}
TSVGSwitchState
array{
'depth': int,
'selected': bool,
'skipdepth': int,
}
TSVGObj
array{
'defsmode': bool,
'defsopen': array<int, string>,
'defsstack': array<int, array{
'name': string,
'open': string,
'close': string,
'records': array<string, string>,
}>,
'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, array<string, TSVGAttribs>>,
'groupstack': array<int, array{'offset': int, 'alpha': float, 'blend': string, 'styledepth': int}>,
'cssrules': array<int, array{'parts': array<int, TSelPart>, 'decl': string, 'sortkey': string}>,
'selchain': array<int, array{'node': TSelNode, 'prev': array<int, TSelNode>}>,
'cssbuffer': string,
'styledepth': int,
'placement': TTMatrix,
'defs': array<string, TSVGAttribs>,
'cliptm': TTMatrix,
'styles': array<int, TSVGStyle>,
'child': array<int>,
'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,
}
Methods
addSVG()
Add a new SVG image and return its object ID.
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): X position in user units.$posy(float): Y position in user units.$width(float): Width in user units.$height(float): Height in user units.$pageheight(float): Page height in user units.$useMarkupResources(bool)
Returns: int: The SVG object ID.
Throws:
- Exception: If SVG data is invalid or parsing fails.
- Exception: If the SVG file cannot be read.
- Exception: If page dimensions cannot be read.
Source: src/SVG.php:9581
getSetSVG()
Get the PDF output string to print the specified SVG object.
public getSetSVG(int $soid): string
Parameters:
$soid(int): SVG Object ID (as returned by addSVG).
Returns: string: Image PDF page content.
Throws:
- Exception: If the SVG object ID is unknown.
Source: src/SVG.php:9773
setLink()
Create a link annotation in the specified rectangular area.
Implemented by descendants that provide annotation/link support.
abstract public setLink(
float $posx,
float $posy,
float $width,
float $height,
string $link
): int
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.
Returns: int: Annotation object ID.
Source: src/SVG.php:486
Inherited members
From Base
- BORDERPOS_DEFAULT: The default relative position of the cell origin when the border is centered on the cell edge.
- BORDERPOS_EXTERNAL: The relative position of the cell origin when the border is external to the cell edge.
- BORDERPOS_INTERNAL: The relative position of the cell origin when the border is internal to the cell edge.
- ZEROCELL: Default values for cell.
- ZEROCELLBOUND: Default values for cell boundaries.
- $barcode: Barcode object.
- $cache: Cache object.
- $color: Color object.
- $encrypt: Encrypt object.
- $file: File object.
- $font: Font object.
- $graph: Graph object.
- $image: Image Import object.
- $markupFile: File object for markup-originated resources.
- $page: Page object.
- $pon: Current PDF object number.
- $uniconv: Unicode Convert object.
- defaultFileAllowedPaths(): Returns the default array of allowed file paths.
- defaultMarkupAllowedPaths(): Returns the default array of allowed file paths for markup-originated resources.
- enableDefaultPageContent(): Enable or disable the default page content.
- getWarnings(): Return the conformance warnings raised while the document was rendered.
- initClassObjects(): Initialize dependencies class objects.
- setPDFVersion(): Set the PDF version (check PDF reference for valid values).
- setRTL(): Set the default document language direction.
- toPoints(): Convert user units to internal points unit.
- toUnit(): Convert internal points to user unit.
- toYPoints(): Convert vertical user value to internal points unit.
- toYUnit(): Convert vertical internal points value to user unit.
From Cell
- setDefaultCellBorderPos(): Sets the default cell border position.
- setDefaultCellMargin(): Set the default cell margin in user units.
- setDefaultCellPadding(): Set the default cell padding in user units.
From Text
- addArtifactContent(): Add non-semantic content wrapped as Artifact marked-content.
- addPage(): Add a new page (wrapper function for $this->page->add()).
- addTaggedFigureContent(): Add non-text graphical content as a tagged Figure block in PDF/UA mode.
- addTextCell(): Adds a text block inside a rectangular cell using relative coordinates.
- addTextCellXY(): Adds a text block inside a rectangular cell using absolute page coordinates.
- beginArtifact(): Open an Artifact marked-content block for non-semantic page content.
- beginStructElem(): Open a PDF/UA structure element bracket.
- defaultPageContent(): Sets the page common content like Header and Footer.
- enableZeroWidthBreakPoints(): Enable or disable automatic line breaking points after some non-letter character types.
- endArtifact(): Close an Artifact marked-content block opened by beginArtifact().
- endStructElem(): Close the current PDF/UA structure element bracket.
- getLastBBox(): Returns the last text fragment bounding box as {x, y, w, h} (left, top, width, height).
- getLastCellBBox(): Returns the last Cell bounding box as {x, y, w, h} (left, top, width, height).
- getLastTextBBox(): Returns the last Text bounding box as {x, y, w, h} (left, top, width, height).
- getTextCell(): Returns the PDF code to render a text block inside a rectangular cell.
- getTextLine(): Returns the PDF code to render a single line of text.
- loadTexHyphenPatterns(): Returns an array of hyphenation patterns.
- resumePdfUaTagging(): Resume structure tagging, restoring the mode returned by suspendPdfUaTagging().
- setCurrentPage(): Set the current page number (move to the specified page).
- setTexHyphenPatterns(): Sets the hyphen patterns for text.
- suspendPdfUaTagging(): Suspend structure tagging and marked-content recording.