Skip to main content

Class: Document

Constructors​

constructor​

β€’ new Document(canvg, Β«destructuredΒ»?)

Parameters​

NameType
canvgCanvg
Β«destructuredΒ»IDocumentOptions

Defined in​

src/Document/Document.ts:104

Properties​

createCanvas​

β–ͺ Static Readonly createCanvas: (width: number, height: number) => HTMLCanvasElement = createCanvas

Type declaration​

β–Έ (width, height): HTMLCanvasElement

Parameters​
NameType
widthnumber
heightnumber
Returns​

HTMLCanvasElement

Defined in​

src/Document/Document.ts:87


createImage​

β–ͺ Static Readonly createImage: (src: string, anonymousCrossOrigin: boolean) => Promise<HTMLImageElement> = createImage

Type declaration​

β–Έ (src, anonymousCrossOrigin?): Promise<HTMLImageElement>

Parameters​
NameTypeDefault value
srcstringundefined
anonymousCrossOriginbooleanfalse
Returns​

Promise<HTMLImageElement>

Defined in​

src/Document/Document.ts:88


elementTypes​

β–ͺ Static Readonly elementTypes: Record<string, AnyElement> = elementTypes

Defined in​

src/Document/Document.ts:89


rootEmSize​

β€’ rootEmSize: number

Defined in​

src/Document/Document.ts:91


documentElement​

β€’ Optional documentElement: SVGElement

Defined in​

src/Document/Document.ts:92


screen​

β€’ Readonly screen: Screen

Defined in​

src/Document/Document.ts:93


createCanvas​

β€’ Readonly createCanvas: CreateCanvas

Defined in​

src/Document/Document.ts:94


createImage​

β€’ Readonly createImage: CreateImage

Defined in​

src/Document/Document.ts:95


definitions​

β€’ Readonly definitions: Record<string, Element> = {}

Defined in​

src/Document/Document.ts:96


styles​

β€’ Readonly styles: Record<string, Record<string, Property<unknown>>> = {}

Defined in​

src/Document/Document.ts:97


stylesSpecificity​

β€’ Readonly stylesSpecificity: Record<string, string> = {}

Defined in​

src/Document/Document.ts:98


images​

β€’ Readonly images: ImageElement[] = []

Defined in​

src/Document/Document.ts:99


fonts​

β€’ Readonly fonts: SVGFontLoader[] = []

Defined in​

src/Document/Document.ts:100


emSizeStack​

β€’ Private Readonly emSizeStack: number[] = []

Defined in​

src/Document/Document.ts:101


uniqueId​

β€’ Private uniqueId: number = 0

Defined in​

src/Document/Document.ts:102


canvg​

β€’ Readonly canvg: Canvg

Defined in​

src/Document/Document.ts:105

Accessors​

window​

β€’ get window(): Window

Returns​

Window

Defined in​

src/Document/Document.ts:137


fetch​

β€’ get fetch(): (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>

Returns​

fn

β–Έ (input, init?): Promise<Response>

Parameters​
NameType
inputRequestInfo | URL
init?RequestInit
Returns​

Promise<Response>

Defined in​

src/Document/Document.ts:141


ctx​

β€’ get ctx(): RenderingContext2D

Returns​

RenderingContext2D

Defined in​

src/Document/Document.ts:145


emSize​

β€’ get emSize(): number

Returns​

number

Defined in​

src/Document/Document.ts:149

β€’ set emSize(value): void

Parameters​

NameType
valuenumber

Returns​

void

Defined in​

src/Document/Document.ts:155

Methods​

bindCreateImage​

β–Έ Private bindCreateImage(createImage, anonymousCrossOrigin?): CreateImage

Parameters​

NameType
createImageCreateImage
anonymousCrossOrigin?boolean

Returns​

CreateImage

Defined in​

src/Document/Document.ts:124


popEmSize​

β–Έ popEmSize(): void

Returns​

void

Defined in​

src/Document/Document.ts:161


getUniqueId​

β–Έ getUniqueId(): string

Returns​

string

Defined in​

src/Document/Document.ts:167


isImagesLoaded​

β–Έ isImagesLoaded(): boolean

Returns​

boolean

Defined in​

src/Document/Document.ts:171


isFontsLoaded​

β–Έ isFontsLoaded(): boolean

Returns​

boolean

Defined in​

src/Document/Document.ts:175


createDocumentElement​

β–Έ createDocumentElement(document): SVGElement

Parameters​

NameType
documentDocument

Returns​

SVGElement

Defined in​

src/Document/Document.ts:179


createElement​

β–Έ createElement<T>(node): T

Type parameters​

NameType
Textends Element<T>

Parameters​

NameType
nodeHTMLElement

Returns​

T

Defined in​

src/Document/Document.ts:190


createTextNode​

β–Έ createTextNode(node): TextNode

Parameters​

NameType
nodeHTMLElement

Returns​

TextNode

Defined in​

src/Document/Document.ts:201


setViewBox​

β–Έ setViewBox(config): void

Parameters​

NameType
configIViewBoxConfig

Returns​

void

Defined in​

src/Document/Document.ts:205