What problem does it solve?
SnapDOM provides a fast, precise way to convert HTML DOM elements into scalable SVGs and raster images, preserving styles, fonts, and pseudo-elements for reliable rendering and sharing.
Core Features & Use Cases
- Universal export options: SVG, PNG, JPG, WebP; Canvas; Blob for raw data.
- Styling & assets preservation: embedded fonts, CSS pseudo-elements, shadows, and icons are preserved.
- Use Case: Generate a high-fidelity snapshot of a UI component for design reviews, documentation, or component libraries, including embedded fonts and icons.
Quick Start
Load the SnapDOM library and capture a target element:
// Create a reusable capture
const result = await snapdom(document.querySelector('#target'));
// Export to different formats
const svg = await result.toSvg();
const png = await result.toPng();
// Optional: download
await snapdom.download(document.querySelector('#target'), 'snapshot.svg');