Engineering brief

Document generation as code: from days of debugging to sub-2ms PDFs

This engineering brief covers Document generation as code: from days of debugging to sub-2ms PDFs, with practical context for AI and developer-tool decisions.

InfoQ

The Brief

A side project using Rust, Typst, and content-addressable storage achieves sub-2ms PDF rendering, turning document workflows into a versioned, reproducible software asset. It solves days-long debugging and compliance nightmares, though Typst's DSL is new and tooling early.

Decision relevance

Read this for workflow impact, implementation trade-offs, and the claims that need technical scrutiny before they reach team planning.

Summary

Banks waiting days for trade confirmations and manufacturers debugging print failures over VPNs share a root cause: treating PDF generation as a GUI task, not a software problem. Crystal Reports and heavy runtimes like headless Chrome or LaTeX create fragile, slow, and unrepeatable pipelines.

A real-world side project swaps those out for a Rust library, the lean Typst typesetter, and serverless architecture. With template caching, render times fall below 2 ms. More importantly, content-addressable storage and manifest-based versioning make the whole document bundle auditable and reproducible—a game-changer for compliance.

The approach treats templates like packages: immutable, hashed, and referenceable. The trade-off: Typst's DSL is new and not WYSIWYG, and the 2 ms speed relies on incremental changes. Still, a million PDFs cost less than 50 cents, and debugging shrinks from hours to minutes because both template and data are versioned.

Engineering leaders should see this as a blueprint for turning document workflows into a proper software discipline. The lesson isn't just about speed—it's that applying modern build, cache, and versioning patterns to neglected subsystems can eliminate operational firefighting and deliver regulatory confidence.

Why It Matters

Document generation bottlenecks become a competitive and compliance risk. This approach reduces operational pain and unlocks reproducibility for audits.

Editorial analysis

Key claims

  • Treating PDF generation as a software problem, not a GUI drag-and-drop, yields order-of-magnitude speed and reproducibility.

Practical use cases

  • Use this as input for tooling evaluation, workflow planning, and technical due diligence.

Risks / caveats

  • The 2ms speed requires narrow caching conditions; full re-layouts are slower.

Who should care

  • Engineering managers, tech leads, and CTOs evaluating AI or developer tooling decisions.

Related topics

Bottom Line

Treating PDF generation as a software problem, not a GUI drag-and-drop, yields order-of-magnitude speed and reproducibility.

Watch

This video is blocked due to your privacy settings. To watch this video, please accept YouTube marketing cookies.

Related breakdowns

Get TL;DW

Too Long; Didn't Watch.

A concise breakdowns of the AI and devtools videos that actually matter for engineering leaders.

Free. Weekly. No hype.

Video and thumbnails remain the property of their respective creators. tldw.news provides editorial analysis, commentary, and discovery links to original content.