Back to Blog
Architecture November 12, 2026 6 min read

Why We Replaced Headless Chromium with Rust & Typst: 15ms PDFs at 1/20th the Cost

Legacy HTML-to-PDF SaaS APIs burn 300MB+ RAM per browser instance and take 1.5s per invoice. Here is how our Rust + Typst renderer drops latency to ~15ms and unlocks $15/mo for 5,000 PDFs.

The Hidden Tax of Puppeteer & Playwright in Document SaaS

Most visual PDF APIs rely on Headless Chromium under the hood. Spinning up a browser context, loading web fonts, running DOM layout, and calling printToPDF consumes 250MB–500MB of RAM and 800ms–2,500ms of CPU time on every burst.

Because infrastructure costs stack up fast, traditional vendors pass that bloat directly to customers—charging $29 to $59/month for just 1,200–2,500 PDFs.

Inside Open Layout’s Hybrid Rust + Typst Pipeline

We kept our 60 FPS React + TipTap visual canvas in apps/web so non-technical users get a Figma-like design experience. When it is time to preview or render via API, apps/pdf-renderer compiles the JSON schema directly into native Typst markup in volatile memory.

With global OnceLock font caching, Typst compiles an A4 invoice with Code-128 barcodes and multi-page expanding tables in roughly 15 milliseconds using ~25MB RAM.

POST /api/v1/templates/:id/render — Timing Headers
HTTP/1.1 200 OK
Content-Type: application/pdf
X-Render-Time-Ms: 14
X-Total-Time-Ms: 38
Content-Length: 42180

More guides from Open Layout