Skip to main content

Interface: ExportRasterOptions

Options for exporting diagram as raster image (e.g. JPEG, PNG, etc).

See

CanvasApi.exportRaster

Extends

Properties

PropertyTypeDescriptionInherited from

addXmlHeader?

boolean

Whether to prepend XML encoding header to the exported SVG string.

Prepended header:

<?xml version="1.0" encoding="UTF-8"?>

Default

false

ExportSvgOptions.addXmlHeader

backgroundColor?

string

Background color for the exported image.

If not specified, the background is transparent by default.

ToDataURLOptions.backgroundColor

height?

number

Target height of the exported image.

If only height is specified, the height is set based on the diagram aspect ratio, otherwise the diagram is fit into desired bounds with margins on sides.

If neither width or height is set, the image size is computed automatically based on maxFallbackSize with 2x maximum resolution for the content.

ToDataURLOptions.height

maxFallbackSize?

Size

Maximum exported image size when neither width nor height is specified.

Default

{width: 4096, height: 4096}

ToDataURLOptions.maxFallbackSize

mimeType?

string

MIME type for the exported raster image.

Example: image/png, image/jpeg, ...

Default

"image/png"

ToDataURLOptions.mimeType

quality?

number

Exported image quality value from 0.0 to 1.0 (applicable only for lossy image types).

Default

1.0

ToDataURLOptions.quality

removeByCssSelectors?

readonly string[]

CSS selectors to exclude specific DOM elements from the exported diagram.

By default, any element with data-reactodia-no-export is removed.

Default

["[data-reactodia-no-export]"]

ExportSvgOptions.removeByCssSelectors

width?

number

Target width of the exported image.

If only width is specified, the height is set based on the diagram aspect ratio, otherwise the diagram is fit into desired bounds with margins on sides.

If neither width or height is set, the image size is computed automatically based on maxFallbackSize with 2x maximum resolution for the content.

ToDataURLOptions.width