+0
Daily
+0
Weekly
+29
Monthly
8,221
stars
310
forks
19
watchers
60
prs
303
issues
78
releases
README
English | 简体中文
SnapDOM
SnapDOM is a high-performance DOM engine that captures a rendered element in the browser and exports it as PNG, SVG or canvas. Plugins turn the same capture into self-contained HTML, PDF, editable vectors, GIF, video or context for agents. Everything runs in the page, with no core dependencies.
Documentation and demos · Technical features · Official plugins · 简体中文
Why SnapDOM
- Speed. Run the live benchmark in your browser: first and repeat captures against html2canvas and the other libraries, sorted by measured time. Unchanged elements reuse their last capture.
- Fidelity. The output matches what the browser painted. Every release runs a pixel suite of real demo pages before it ships.
- Flexibility. Capture once, export many formats. Official plugins add outputs, and the same plugin hooks let you write your own.
- Maintenance. About one release a week over the past year, MIT licensed, with a public changelog.
Quick start
sh
npm i @zumer/snapdom
js
import { snapdom } from '@zumer/snapdom';
const card = document.querySelector('card');
const image = await snapdom.toPng(card);
document.body.appendChild(image);
Capture once when you need several outputs:
js
const result = await snapdom(card);
const image = await result.toPng();
const canvas = await result.toCanvas();
const blob = await result.toBlob({ format: 'png' });
await result.download({ format: 'jpg', filename: 'card' });
The result keeps that capture even if the source element later changes. Call snapdom(card) again to capture its new state.
What you can build
| Use | Output | Provided by |
| --- | --- | --- |
| Share a card, chart, invoice or dashboard | SVG, PNG, JPG, WebP, canvas or Blob | Core |
| Reuse a capture in a texture, overlay or transition | Canvas plus capture geometry | Core |
| Prepare the capture before export | Redacted fields, replaced text, CSS filter effects or a timestamp label | redact-inputs, replace-text, filter and timestamp-overlay plugins |
| Save a page fragment for later display | HTML with captured styles and fonts | html-export plugin |
| Give an agent or a log a view of page content | Text/JSON context, or an image with an element map | context-export / agent-map plugins |
| Download a document or record changing content | Searchable, paginated PDF, animated GIF or browser-encoded video | pdf / gif-export / video-export plugins |
| Stream a live element into a WebGL texture or a video overlay | Canvas that repaints only what changed | stream plugin |
| Export editable artwork or paste into Figma | Native SVG shapes and text, or a Figma clipboard payload | vector plugin |
Image, HTML and context exports use the captured state. GIF and video plugins record the live element over time; Stream keeps following it.
Ecosystem
Products, each with its own landing page and reference:
- PDF: a searchable, paginated PDF export with selectable text, links and optional form fields.
- Vector: editable SVG and Figma clipboard ex