case_study
pdfblaze: a CRM's PDFs without Chrome
Rust · HTML and CSS to PDF · CLI, worker protocol, C library
Fork maintainer — engine choice, memory, security hardening, release engineering, CRM rollout
- Rust
- seccomp
- dhat
- zig (glibc 2.17)
- Sigstore attestations
- CycloneDX SBOM
- GitHub Actions
- Ruby on Rails

problem
The problem
The CRM had two ways to make a PDF and both hurt. Headless Chrome took about 976 MiB for a cold document, and a warm Chrome grew from 1,252 to 9,404 MiB over 52 renders until a staging worker froze. The old Ruby library built every page in Ruby, so a 1,000-message chat transcript took 16.5 seconds and grew the app process by 389 MB.
Porting a Python engine was sized at 12 to 20 engineer-weeks for our templates alone and years for the whole thing. Writing a new engine was out. The question was which existing engine prints our real templates the way Chrome does, at a fraction of the memory, and whether it can be trusted with documents that come from customers.
approach
What I engineered
- A measurement first: eight engines on the same single-page quote and on documents up to 2,000 rows, then the 13 real CRM templates printed by Chrome and by the candidate and compared page by page as images.
- A fork of an MIT/Apache-2.0 Rust engine, with only the work after the fork claimed as mine: a memory pass on a 119-page invoice that took the heap from 63.5 to 33.1 MB, DOM nodes from 152 to 72 bytes, with a counting-allocator test as the guard and 668 test PDFs kept byte-identical through every change.
- A security audit the same day as the rollout: 13 findings, including a 10 KB image that crashed the renderer through five million nested PDF objects and a worker-pool example that could hand one tenant's PDF to the next caller. High and Medium fixed in 1.4.2, Low in 1.4.3, each with a guard test checked by reverting the fix.
- Hard limits on hostile input: time and memory budgets that now stop runaway CSS counters and huge column layouts in about a second, a seccomp filter that refuses signals to other processes and typing into the terminal, and links in merged PDFs limited to safe schemes.
- Releases you can verify: eight binary targets and a C library for five, built back to glibc 2.17 with zig, FreeBSD in a VM, SHA-256 sums, CycloneDX SBOMs and Sigstore build provenance signed in a separate job that is the only one allowed to sign.
- The CRM rollout: the quote and every document the old library drew moved to one engine over a framed worker protocol, with the largest document each engine can print measured, and honest notes where the new path is slower.
result
The result
On the 13 real templates pdfblaze takes a median of 21 ms against 275 ms for a warm Chrome, at about 26 MiB per document instead of about 976 MiB for a cold one; 9 match Chrome, 4 differ slightly and none are broken. The 1,000-message transcript went from 16.5 seconds to 0.8.
It went from fork to production in under 20 hours. Not everything is better: a three-line quote got slower (18 to 59 ms) because a process start replaced an in-process call, the memory budget is an estimate rather than a hard cap, and copying Hindi or Arabic text out of the PDF still gives the wrong characters. Those are written down in the series, with what comes next.
- 21 ms vs 275 ms
- median per template, pdfblaze vs warm Chrome
- 26 vs 976 MiB
- memory per document vs cold Chrome
- 16.5 s → 0.8 s
- 1,000-message transcript
- 9 of 9
- High, Medium and Low audit findings fixed the same day
Measured on a laptop on 13 real CRM templates filled with synthetic sample data, and on the release binaries in December 2026. The CRM is not named. pdfblaze is a fork of an open-source Rust engine; only the work after the fork is claimed here.
work_with_me
Have a project like this?
Tell me the problem on a 20-minute call and I'll tell you how I'd approach it, the same way pdfblaze: a CRM's PDFs without Chrome started.
Discuss your project