Replacing WebView2 print-to-PDF with an embedded Typst engine (Rust)
Inkwell, a desktop Markdown editor, has transitioned from using a browser-based PDF export to an embedded Rust typesetting engine called Typst. This change allows for consistent PDF generation across all platforms, overcoming previous limitations tied to the browser's print API. The integration of Typst enables a more reliable and feature-rich document export process.
- ▪Inkwell previously relied on the webview's print API, which was only functional on Windows.
- ▪The new Typst engine allows for Markdown to be converted directly to Typst markup, improving the PDF export process.
- ▪The integration of Typst eliminates the need for a browser and provides a cleaner, more efficient way to generate PDFs.
Opening excerpt (first ~120 words) tap to expand
Inkwell is a desktop Markdown editor built with Tauri and Rust. Until version 1.4, exporting a document to PDF worked on exactly one platform: Windows. The macOS and Linux builds returned an error if you even tried. This is the story of why that was, and how a Rust typesetting engine called Typst fixed it. I. The browser was doing the typesetting A Tauri app doesn’t bundle a browser. It uses whatever webview the OS already ships, WebView2 (Chromium) on Windows, WKWebView on macOS, WebKitGTK on Linux. That’s what keeps the binary around 40 MB instead of 150. The original PDF export leaned on that webview. On Windows it called WebView2’s COM PrintToPdf interface — the same machinery behind Ctrl+P → Save as PDF in Edge. It worked. But it had three problems: It was Windows-only.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at 4worlds.dev.