Document

SVG document loading, size, prescan and output.

Namespace: Com\Tecnick\Pdf\SVG

trait Document

Source: src/SVG/Document.php:43

SVG document loading, size, prescan and output.

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/Document.php:455

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/Document.php:712