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
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
MIME_TYPES
Available MIME types for export.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
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
Export Options Reference
AppState Export Properties
CommonappState properties used in export functions:
Complete Export Example
Here’s a complete example with export to multiple formats:See Also
- Element Utils - Creating and manipulating elements
- Scene Utils - Scene management
- Restore Utils - Loading and restoring data