All posts

Typst and Rust cut PDF render time to under 2ms

Manaal KhanJune 30, 2026 at 3:47 AM5 min read
Typst and Rust cut PDF render time to under 2ms

Key Takeaways

Typst and Rust cut PDF render time to under 2ms
Source: InfoQ
  • Typst with serverless Rust drops PDF render latency from seconds to under 2ms
  • Git and Docker workflows for template registries enable compliance auditing in regulated industries
  • Legacy PDF pipelines using Puppeteer or LaTeX struggle with memory, speed, and debugging at scale

Erik Steiger, a senior software engineer, presented a case for replacing legacy PDF generation stacks with Typst and Rust. Speaking at InfoQ Dev Summit Munich, he showed how regulated industries like banking and manufacturing can cut render latency from seconds to under 2 milliseconds while gaining compliance-friendly version control.

Advertisement

Why legacy PDF pipelines break at scale

Steiger shared two painful experiences from consulting work. At a German bank, the PDF pipeline had degraded to the point where customers waited days for transaction documents. That's not just bad UX. German regulators told the bank it violated compliance rules. The team explored AWS Lambda, but after two years they were still wrestling with Java-based pre-compiled templates. Steiger suspects they haven't shipped yet.

The second case came from manufacturing. A truck couldn't leave a facility because a weighing slip wouldn't print. Debugging required jumping through two VPNs to a remote desktop just to confirm an error existed. No version history. No clear template ownership. No way to trace which template version produced which document.

Both problems stem from the same architectural choices. Puppeteer spins up headless Chrome to render HTML to PDF, eating memory and taking seconds per document. LaTeX offers precision but punishes you with cryptic errors and slow compilation. Neither approach plays well with modern serverless infrastructure or audit trails.

What Typst changes about document generation

Typst is an open-source typesetting system created by Martin Haug and Laurenz Mädje, two German students who started the project in 2019 and released it publicly in 2023. They built it because LaTeX, despite 40 years of dominance, remains hostile to newcomers and painfully slow to iterate on.

Typst compiles incrementally. Change one line, and you see the result in milliseconds. The syntax is simpler than LaTeX but still expressive enough for academic papers, invoices, and compliance documents. More importantly for Steiger's use cases, Typst is written in Rust. That means it compiles to small, fast binaries that fit comfortably in serverless functions.

Steiger's architecture pairs Typst with a Rust-based serverless setup. The result: render latencies below 2 milliseconds. For a bank generating millions of PDFs per day, that's the difference between a pipeline that scales horizontally and one that chokes under load.

Git and Docker for template compliance

Speed alone doesn't solve regulated industries' second problem: knowing which template version produced which document. Steiger's approach treats templates like code. Store them in Git. Version them. Review changes through pull requests. Tie each generated PDF to a specific commit hash.

For deployment, Docker containers package each template version. When a regulator asks "what did the weighing slip look like six months ago," you pull the container and render it. No guessing. No archaeology through email threads.

This is standard practice in application development. It's surprisingly rare in document generation, where templates often live in databases or shared drives with no history.

Advertisement

Where this approach fits and where it doesn't

Typst excels at structured documents: invoices, certificates, reports, forms. If your PDF is fundamentally a data merge into a fixed layout, Typst handles it well. The language supports conditionals, loops, and custom functions, so complex logic is possible without escaping to an external preprocessor.

It's less suited for documents that need pixel-perfect reproduction of arbitrary HTML. Marketing teams that want to render a webpage as a PDF will still reach for Puppeteer or its faster cousin Playwright. But those teams aren't generating millions of documents per day. For high-volume transactional documents, the tradeoff favors Typst.

ℹ️

Logicity's Take

Steiger's talk highlights a gap in enterprise tooling. Most PDF generation advice targets either hobbyists (use wkhtmltopdf) or enterprises with bottomless budgets (buy Adobe's server tools). Teams in the middle, generating hundreds of thousands of documents with compliance requirements, have been stuck duct-taping Puppeteer containers together. Typst won't replace every PDF workflow, but for document-heavy fintech, logistics, and manufacturing, it's worth benchmarking against your current stack. The open-source license means you can prototype without procurement cycles.

Getting started with Typst in production

Typst offers a CLI and a web editor at typst.app. For server-side use, the Rust crate compiles Typst documents programmatically. Steiger's serverless approach wraps this crate in an AWS Lambda or similar function, accepting JSON data and returning a PDF binary.

The learning curve is gentler than LaTeX. Typst's documentation covers common patterns, and the error messages are human-readable. Teams with LaTeX experience will find the transition straightforward. Teams currently using HTML-to-PDF converters will need to rewrite templates, but the performance gains may justify the investment.

Frequently Asked Questions

How fast is Typst compared to Puppeteer for PDF generation?

Steiger reports sub-2ms render times with Typst and Rust, compared to seconds for Puppeteer. The exact speedup depends on document complexity and server configuration.

Can Typst replace LaTeX for academic papers?

Yes. Typst supports mathematical notation, citations, and multi-column layouts. Several academic journals now accept Typst submissions alongside LaTeX.

Is Typst production-ready for enterprise use?

Typst is open-source and actively maintained. Companies in regulated industries are using it, as Steiger's examples show. Evaluate it against your specific compliance and support requirements.

What's the difference between Typst and Markdown for documents?

Markdown is a lightweight format for simple text. Typst is a full typesetting language with precise layout control, scripting, and native PDF output. It's closer to LaTeX than to Markdown.

Also Read
Chamath Palihapitiya raises $135M for AI coding startup 8090 Labs

Another example of infrastructure tooling attracting serious investment

ℹ️

Need Help Implementing This?

If your team is evaluating document infrastructure or struggling with PDF generation at scale, reach out to Logicity. We connect engineering leaders with the technical expertise to modernize legacy pipelines.

Source: InfoQ

Advertisement
M

Manaal Khan

Tech & Innovation Writer

Produced with AI assistance and reviewed by the Logicity editorial team. Learn more in our Editorial Policy.

Related Articles