[]
        
(Showing Draft Content)

SvgDocument

DsPdfJS API v9.1.0


DsPdfJS API / SvgDocument

Class: SvgDocument

Represents an SVG document.

Extends

Accessors

cursiveFont

Get Signature

get cursiveFont(): Font | null

Gets or sets the font belonging to the Cursive font family.

Returns

Font | null

Set Signature

set cursiveFont(font): void

Gets or sets the font belonging to the Cursive font family.

Parameters
font

Font | null

Returns

void


description

Get Signature

get description(): string

Gets the description of the SVG document.

Returns

string


fantasyFont

Get Signature

get fantasyFont(): Font | null

Gets or sets the font belonging to the Fantasy font family.

Returns

Font | null

Set Signature

set fantasyFont(font): void

Gets or sets the font belonging to the Fantasy font family.

Parameters
font

Font | null

Returns

void


fontCollection

Get Signature

get fontCollection(): FontCollection | null

Gets or sets the custom FontCollection used for searching fonts and font fallbacks.

Returns

FontCollection | null

Set Signature

set fontCollection(coll): void

Gets or sets the custom FontCollection used for searching fonts and font fallbacks.

Parameters
coll

FontCollection | null

Returns

void


fontFallbackScope

Get Signature

get fontFallbackScope(): FontFallbackScope

Gets or sets a value specifying the scope for searching fallback fonts for the glyphs missing in the mentioned type faces.

Returns

FontFallbackScope

Set Signature

set fontFallbackScope(fallbackScope): void

Gets or sets a value specifying the scope for searching fallback fonts for the glyphs missing in the mentioned type faces.

Parameters
fallbackScope

FontFallbackScope

Returns

void


id

Get Signature

get id(): number

Gets the reference to the object.

Returns

number

Inherited from

ObjectBase.id


monospaceFont

Get Signature

get monospaceFont(): Font | null

Gets or sets the font belonging to the Monospace font family.

Returns

Font | null

Set Signature

set monospaceFont(font): void

Gets or sets the font belonging to the Monospace font family.

Parameters
font

Font | null

Returns

void


om

Get Signature

get om(): ObjectManager

Gets the owner ObjectManager instance.

Returns

ObjectManager

Inherited from

ObjectBase.om


restrictedFontLookup

Get Signature

get restrictedFontLookup(): boolean

Gets or sets a value indicating whether the fonts should be searched in the custom collection only, if any specified. The default is false.

Returns

boolean

Set Signature

set restrictedFontLookup(value): void

Gets or sets a value indicating whether the fonts should be searched in the custom collection only, if any specified. The default is false.

Parameters
value

boolean

Returns

void


sansSerifFont

Get Signature

get sansSerifFont(): Font | null

Gets or sets the font belonging to the SansSerif font family.

Returns

Font | null

Set Signature

set sansSerifFont(font): void

Gets or sets the font belonging to the SansSerif font family.

Parameters
font

Font | null

Returns

void


serifFont

Get Signature

get serifFont(): Font | null

Gets or sets the font belonging to the Serif font family.

Returns

Font | null

Set Signature

set serifFont(font): void

Gets or sets the font belonging to the Serif font family.

Parameters
font

Font | null

Returns

void


title

Get Signature

get title(): string

Gets the title of the SVG document.

Returns

string

Methods

load()

Call Signature

static load(svgBytes): SvgDocument

Loads a SvgDocument from a byte array.

Parameters
svgBytes

Uint8Array

The binary data of the SVG document.

Returns

SvgDocument

A new instance of the SVG document.

Call Signature

static load(om, svgBytes): SvgDocument

Loads a SvgDocument from a byte array.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the SvgDocument object.

svgBytes

Uint8Array

The binary data of the SVG document.

Returns

SvgDocument

A new instance of the SVG document.


loadGz()

Call Signature

static loadGz(gzSvgBytes): SvgDocument

Loads a SvgDocument from a byte array with gzipped SVG data.

Parameters
gzSvgBytes

Uint8Array

The binary data of the gzipped SVG document.

Returns

SvgDocument

A new instance of the SVG document.

Call Signature

static loadGz(om, gzSvgBytes): SvgDocument

Loads a SvgDocument from a byte array with gzipped SVG data.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the SvgDocument object.

gzSvgBytes

Uint8Array

The binary data of the gzipped SVG document.

Returns

SvgDocument

A new instance of the SVG document.


free()

free(): void

Detaches the object from the ObjectManager and deallocates its memory, if possible.

Returns

void

Inherited from

ObjectBase.free


getIntrinsicSize()

getIntrinsicSize(): Size | null

Gets the intrinsic size of SVG viewport.

Returns

Size | null

The intrinsic size of SVG viewport, or null if the size is undefined.


measure()

measure(x, y): Rect

Calculates the content bounds of an SVG document when its viewport is drawn at a specified point.

Parameters

x

number

The X coordinate of SVG viewport.

y

number

The Y coordinate of SVG viewport.

Returns

Rect

The content rectangle of the resulting image.


measureToRect()

Call Signature

measureToRect(x, y, width, height): Rect

Calculates the content bounds of an SVG document, resizing the SVG viewport to fit into a specified rectangle.

Parameters
x

number

The X coordinate of the target rectangle for SVG viewport.

y

number

The Y coordinate of the target rectangle for SVG viewport.

width

number

The width of the target rectangle for SVG viewport.

height

number

The height of the target rectangle for SVG viewport.

Returns

Rect

The content rectangle of the resulting image.

Call Signature

measureToRect(bounds): Rect

Calculates the content bounds of an SVG document, resizing the SVG viewport to fit into a specified rectangle.

Parameters
bounds

Bounds

The target rectangle for SVG viewport.

Returns

Rect

The content rectangle of the resulting image.


rebind()

rebind(omTo): void

Rebinds the object from the current ObjectManager to the specified one.

Parameters

omTo

ObjectManager

The new ObjectManager for the object.

Returns

void

Inherited from

ObjectBase.rebind


save()

save(options?): Uint8Array

Saves the current SvgDocument to a byte array.

Parameters

options?

SaveSvgOptions

The settings for saving the document.

Returns

Uint8Array

A byte array with UTF8-encoded SVG data.


saveGz()

saveGz(): Uint8Array

Saves the current SvgDocument to a byte array in SVG.GZ format.

Returns

Uint8Array


setCurrentColor()

setCurrentColor(color): void

Sets the 'currentColor' value used by the SVG renderer.

Parameters

color

Color | null

Returns

void


setLanguageTags()

setLanguageTags(langTags): void

Sets the list of cultures to match values of the 'systemLanguage' attribute of SVG elements.

Parameters

langTags

string[] | null

Returns

void