Skip to main content

Interface: ToPNGOptions

Defined in: packages/sdvplot/src/export/index.ts:18

Options for toPNG.

Properties​

background?​

optional background?: string

Defined in: packages/sdvplot/src/export/index.ts:24

a color painted under transparent areas; absent: transparent


color?​

optional color?: string

Defined in: packages/sdvplot/src/export/index.ts:29

the root color, which currentColor (Plot's axes and text) resolves to; absent: the SVG's own root color, else black or white, whichever contrasts more with background (black when there is no background)


fonts?​

optional fonts?: object

Defined in: packages/sdvplot/src/export/index.ts:42

the fonts <text> is drawn with. resvg draws text only in fonts it has loaded, and with none (a host without system fonts: slim Docker images, minimal CI runners) every label renders as nothing, with no error. files: font files (.ttf, .otf, .ttc) on disk to load, each checked to exist; defaultFamily: the family for text whose own families are not loaded (absent: resvg's choice, the first font loaded); system: also load the system fonts, default true. Absent: the system fonts only.

defaultFamily?​

optional defaultFamily?: string

files?​

optional files?: readonly string[]

system?​

optional system?: boolean


images?​

optional images?: "fetch" | "skip"

Defined in: packages/sdvplot/src/export/index.ts:34

remote <image href="http(s)://…"> (logos, headshots): "fetch" (default) downloads each once with the global fetch and draws it, a failed download throwing DownloadError; "skip" leaves them out with one warning


scale?​

optional scale?: number

Defined in: packages/sdvplot/src/export/index.ts:22

device-pixel multiplier, a positive number; default 1


width?​

optional width?: number

Defined in: packages/sdvplot/src/export/index.ts:20

output width in CSS pixels, the height following (multiplied by scale); absent: the SVG's own size