Versioning
This library tries to keep in sync with the upstream typst version for simplicity - as this doesn't bump the typst version it's released as 0.15.1.1, rather than 0.15.2
⚠️ Breaking Changes
- Strict PDF standard validation: Invalid or contradictory combinations of PDF standards (such as specifying two PDF/A levels or requesting a PDF/A profile that contradicts the target PDF version) now fail compilation and throw an exception with diagnostic messages and hints from Typst. Previously, errors from
PdfStandards::newwere silently ignored, causing pipelines to fall back to producing standard PDFs unannounced.Note: Typst's PDF/A and PDF/UA exporters deliberately omit build timestamps. Ensure target documents define their own metadata via
#set document(date: ...)(plustitleandlanguagefor PDF/UA compliance). - Streaming
CompilePdfoverloads return warnings:compiler.CompilePdf(Stream),compiler.CompilePdfAsync(Stream),compiler.CompilePdf(string outputFile), andcompiler.CompilePdfAsync(string outputFile)now stream directly from native memory to the destination and return compiler warnings rather than returning an in-memoryPdfResult. Usecompiler.CompilePdf()when you need the byte buffer materialized directly.
🚀 Added
- Zero-copy document handling (
CompileToDocument): Addedcompiler.CompileToDocument(...), which returns a disposableTypstDocumentexposing rendered output directly from native allocations.- Use
GetOutputSpan,OpenOutputStream,CopyOutputTo,WriteOutputToFile, orRentOutputto inspect and stream large files without putting multi-megabyte buffers on the Large Object Heap (LOH). - Use
GetOutputByteswhen a managedbyte[]allocation is explicitly required.
- Use
- Streamlined compilation APIs:
- Added
compiler.CompilePdf(...)returning aPdfResultwith implicit conversions tobyte[],ReadOnlySpan<byte>, andReadOnlyMemory<byte>. - Added
compiler.CompilePdf(string outputFile)andcompiler.CompilePdfAsync(string outputFile)for direct file output. - Added
compiler.CompilePdf(Stream destination)andcompiler.CompilePdfAsync(Stream destination)for stream pipelines. - Added static convenience one-liners:
TypstCompiler.CompilePdf(...)andTypstCompiler.CompilePdfFromFile(...). - Added dedicated format export helpers:
compiler.CompileSvg(...)andcompiler.CompilePng(...). - Added
outcome.AsPdf()andoutcome.PrimaryBufferproperties toCompileOutcome.
- Added
- Simultaneous multi-standard PDF export: Added support for compiling documents against multiple PDF standards simultaneously (e.g.,
v-1.7,a-2b) via thepdfStandardsparameter inTypstCompiler.Compile, leveraging the updatedtypst-pdfcrate in Typst 0.15. - Offline / vendored package control: Added
includeSystemPackagestoTypstCompiler. Setting this tofalseenforces strictly local package resolution frompackagePath, preventing unexpected downloads from Typst Universe and guaranteeing isolated, offline compilation.
🔄 Changed
- Reduced managed heap allocations:
compiler.Compile(outputFile, format)andcompiler.CompileSvg(...)now stream and write data without allocating intermediate copies on the managed heap.
🐛 Fixed
- Windows subfolder path crash: Fixed an issue where passing a subfolder path with backslashes on Windows (e.g.,
templates\letter.typ) caused Typst's virtual path parser to panic inside a native call and crash the host process. Input paths are now resolved against the project root prior to virtual path normalization, and paths attempting to escape the root boundary return compilation errors instead of panicking.Note: On Windows, the project root is matched textually against absolute input paths; both paths must use matching casing.
- PDF/UA-1 rejection in
pdfStandards: Fixed an issue whereua-1(PDF/UA-1 accessibility standard) was rejected. Accepted standard names are now sourced directly fromtypst_pdf::PdfStandard, ensuring immediate compatibility with all current and future standards supported by Typst. Thev-prefix convention remains supported solely for standard PDF versions (e.g.,v-1.7).
New Contributors
Full Changelog: 0.15.1...0.15.1.1