Browser-only PDF export prototype

This page is a technical prototype for producing a real vector PDF entirely in the browser, without the browser print dialog:

  1. vivliostyle paginates an HTML/CSS Paged Media document inside a hidden iframe.
  2. A custom DOM→PDF emitter walks the paginated output (measured text positions, fonts, images, backgrounds, borders, link rects) and re-renders it with @pdfme/pdf-lib.
  3. The resulting PDF bytes are downloaded as a file.

Everything runs client-side. No server is involved after the page has loaded, and no print dialog is opened.

The demo document exercises: running headers, page-number footers, footnotes, a table of contents with resolved page numbers, cross references with auto-resolved page numbers, tables (one spanning a page break), SVG and PNG figures, inline styles (bold, italic, bold-italic, strikethrough, small caps, monospace code), and hyperlinks. In the generated PDF, links are clickable annotations: external links open their URL, and TOC entries / cross references jump to the target page. The PDF also carries things the print dialog cannot produce: document metadata from the source's <title>/<meta> tags, a bookmarks sidebar (shown automatically), and the pre-pagination HTML source embedded as a file attachment.

Edit source HTML/CSS