Skip to content
SnapDOMTry SnapStudioGitHub★ 8K
How-To Recipe

Export an invoice or report

Create a shareable snapshot of a printable browser component while preserving its exact CSS and fonts.

TL;DR

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.

INVOICE #1042PAID

SnapDOM Labs · July 16, 2026


DOM capture integration$480.00
Performance audit$120.00

Total$600.00
The captured result will appear here.

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.