Overview
Press.js was built on a simple premise: PDFs should be built like web apps.
Most PDF generation tools fall into three camps:
- Template engines — you write HTML-like templates with a proprietary syntax, and the engine fills them with data. Debugging requires a special viewer, and complex layouts often hit the limits of what the template language can express.
- Drawing APIs — you issue commands like
drawRect,setFont, anddrawTextin code. This gives you full control but makes even simple documents tedious to write and hard to maintain. - Headless browsers — you write standard HTML/CSS and feed it to a headless browser like Puppeteer or Playwright, which renders the page and calls
page.pdf(). This gives you the full power of the web platform, but the output is a naive “print screen” — there is no pagination intelligence. Content is blindly sliced at page boundaries, leaving you to manually manage orphans, widows, and breakpoints with fragile CSS rules.
Press.js takes a different approach: your document is a web app. You build it with the same components, styles, and tools you use for any frontend project. Press.js captures the rendered output and re-paginates it into a print-ready PDF.
In this section
Section titled “In this section”- Core Principles — the four design principles behind Press.js
- Caveats — visual effects, layout patterns, and performance patterns to avoid
- Fonts — font management, self-hosting, and the font audit tool
- Best Practices — tips for building reliable, high-quality documents
- Known Limitations — current constraints and unsupported features
- Report & Feedback — how to report issues and contribute