Browser-side document export

React DOM to real vector PDF.

A print pipeline for teams that already own their React UI. It reads computed styles from the live browser DOM, then emits selectable text, embedded fonts, real images, pagination, and raster fallbacks through pdf-lib.

invoice.pdfvector primitives
DOM boxesrect
Text rectsglyph
PNG/JPEGxobj
Repeat bandspage

Pipeline

1DOM
2styles
3primitives
4pages
5pdf-lib

No server

0 Chromium

Current bundle

~36 KB ESM

Test coverage

unit + e2e

Enterprise-safe architecture

Everything runs in the user's browser. No uploaded invoices, no PDF job queue, no headless browser fleet.

Uses your design system

Tailwind v4, CSS-in-JS, tokens, and resolved CSS all collapse to computed styles before export.

Pagination built in

Headers, footers, manual breaks, break-inside avoidance, and repeating table headers are part of the pipeline.

Raster where vector stops

Gradients, shadows, transforms, filters, and SVG regions are captured as PNG fallback regions.

Integration shape
const ref = useRef<HTMLDivElement>(null);

const result = await exportToPDF(ref.current, {
  format: "A4",
  margin: "20mm",
  filename: "invoice.pdf",
  header: ({ pageNumber, totalPages }) => (
    <div>Page {pageNumber} / {totalPages}</div>
  ),
});

result.save();