Export an invoice or report
Create a shareable snapshot of a printable browser component while preserving its exact CSS and fonts.
Capture the printable component with a white background, then use scale to size the downloaded PNG or JPEG.
Export the invoice as PNG
Install @zumer/snapdom, select the rendered element, and capture it:
import { snapdom } from '@zumer/snapdom'
const invoice = document.querySelector('#invoice')
const capture = await snapdom(invoice, {
backgroundColor: '#ffffff',
embedFonts: true,
scale: 2,
exclude: ['.invoice-actions'],
})
await capture.download({ format: 'png', filename: 'invoice-1042' })A dedicated wrapper keeps the export predictable
A dedicated invoice wrapper keeps export dimensions and styling predictable. Hide editing and payment controls from the capture while leaving the live UI intact.
Export this invoice preview
The action controls stay outside the target, exactly as they should in a production invoice UI.
SnapDOM Labs · July 16, 2026
Limits and common mistakes
SnapDOM produces an image snapshot. For selectable text, multiple pages, repeated headers or print pagination, use the PDF plugin instead.
Frequently asked questions
Can I create a PDF?
Yes. Use the PDF plugin: toPdf() returns a paginated PDF with selectable text.
Should invoices use JPEG?
PNG keeps text and fine rules crisp. JPEG can be smaller for photo-heavy reports but introduces compression artifacts.