SVG

SVG PDF class

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:

Source: src/SVG.php:9773

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

From Cell

From Text