Skip to main content

Export Utilities

Utilities for exporting Excalidraw scenes and elements to canvas, blob, SVG, and clipboard formats.

Canvas Export

exportToCanvas

Exports elements to an HTML canvas element.
ExcalidrawElement[]
required
Array of non-deleted elements to export
Partial<AppState>
Application state for export settings (background color, export scale, etc.)
BinaryFiles | null
required
Binary files map for image elements
number
Maximum dimension (width or height) for the exported canvas. The canvas will be scaled down to fit.
number
Padding around the exported content in pixels
ExcalidrawFrameLikeElement | null
Specific frame to export (exports only elements within the frame)
function
Custom function to calculate canvas dimensions. Receives natural width and height, returns target dimensions and optional scale.
HTMLCanvasElement
The rendered canvas element with the exported content
Example:

Blob Export

exportToBlob

Exports elements to a blob (PNG, JPEG, or SVG).
ExcalidrawElement[]
required
Array of non-deleted elements to export
Partial<AppState>
Application state for export settings
BinaryFiles | null
required
Binary files map for image elements
string
default:"'image/png'"
Output format: “image/png”, “image/jpeg”, or “image/svg+xml”
number
Quality for JPEG export (0-1). Default is 0.92 for JPEG, 0.8 for PNG.
number
Padding around the exported content in pixels
number
Maximum dimension for the exported image
ExcalidrawFrameLikeElement | null
Specific frame to export
Blob
The exported content as a Blob
Example:

MIME_TYPES

Available MIME types for export.
Example:

SVG Export

exportToSvg

Exports elements to an SVG element.
ExcalidrawElement[]
required
Array of non-deleted elements to export
Partial<AppState>
Application state for export settings
BinaryFiles
Binary files map for image elements
number
Padding around the exported content in pixels
boolean
Whether to render embeddable elements (iframes, etc.)
ExcalidrawFrameLikeElement | null
Specific frame to export
boolean
Skip inlining fonts (fonts must be available on the target system)
boolean
Reuse image references instead of embedding them
SVGSVGElement
The exported SVG element
Example:

Clipboard Export

exportToClipboard

Exports content to the system clipboard.
ExcalidrawElement[]
required
Array of non-deleted elements to export
Partial<AppState>
Application state for export settings
BinaryFiles | null
required
Binary files map for image elements
'png' | 'svg' | 'json'
required
Export format for clipboard
string
MIME type (used for PNG export)
number
Quality for PNG export (0-1)
Promise<void>
Promise that resolves when content is copied to clipboard
Example:

Export Options Reference

AppState Export Properties

Common appState properties used in export functions:
Example:

Complete Export Example

Here’s a complete example with export to multiple formats:

See Also