turbo-html2pdf
v0.8.8
Published
Fast native HTML/CSS + Jinja templating to PDF for Node — no headless browser, no Chromium.
Maintainers
Readme
turbo-html2pdf
Native HTML/CSS and Jinja-style templates to PDF for Node. Layout, pagination and PDF generation run in Rust without Chromium or a separate service.
npm install turbo-html2pdfconst { compile } = require('turbo-html2pdf')
const { writeFileSync } = require('node:fs')
const program = compile('<h1>{{ title }}</h1><p>{{ body }}</p>')
const { pdf, pageCount, diagnostics } = program.render({
data: { title: 'Hello', body: 'World' },
css: '@page { size: A4; margin: 20mm }',
})
writeFileSync('out.pdf', pdf)Compile once and render many times. Default sans-serif, serif and monospace fonts
are bundled. Pass named font objects to Fonts.load or render to use your own.
The addon supports named PNG/JPEG images, headers, footers, footnotes, endnotes,
links, watermarks, PDF append, PDF/A-2b, PDF/UA-1, CMYK, AES-256 encryption and
text stamping of existing PDFs. Install turbo-html2pdf-svg for SVG images.
Output is deterministic for the same inputs except when encryption is enabled.
HTML/CSS support is a subset; the engine does not fetch external assets.
- API and examples
- Features and runtime limits
- Template and pagination guide
- Benchmarks and deployment
- TypeScript API
See the 0.8.8 release notes.
MIT; bundled fonts have separate notices in THIRD_PARTY_NOTICES.md.
