- Fixed an input path in a subfolder aborting the process instead of compiling. The path was handed to Typst verbatim, and a Typst virtual path only accepts forward slashes, so on Windows an ordinary relative path such as
templates\letter.typpanicked inside a native call and took the host process down with it. Paths are now resolved against the project root before being converted, and a path that genuinely leaves the root reports an error instead of panicking. Note that the root is matched against an absolute input path textually, so on Windows both have to be spelled with the same casing. - Fixed
ua-1(PDF/UA-1, the accessibility standard) being rejected bypdfStandards. The accepted names are now taken fromtypst_pdf::PdfStandarditself, so every standard Typst supports is accepted, including ones added by later Typst releases. The documentedv-prefix on plain PDF versions still works, and applies only to them:v-a-2bis not a spelling ofa-2b.
- Breaking: an invalid combination of PDF standards now fails the compilation instead of silently producing an ordinary PDF. The validation error from
PdfStandards::newwas discarded and export fell back to the default, so a pipeline could believe it was writing PDF/A while it was not. Combinations such as two PDF/A levels, or a PDF/A level that contradicts the requested PDF version, now throw with the message and hints from Typst. Callers passing a contradictory combination today receive a document and will receive an exception after this change. - Note for PDF/A and PDF/UA: the exporter deliberately writes no timestamp, so the document has to carry its own date (
#set document(date: ...)) and, for PDF/UA, a title and language. compiler.CompilePdf(Stream),compiler.CompilePdfAsync(Stream),compiler.CompilePdf(string outputFile)andcompiler.CompilePdfAsync(string outputFile)now stream the document straight from native memory to the destination and return the compiler warnings, rather than returning aPdfResultthat had to be materialised on the managed heap first. Usecompiler.CompilePdf()when you want the bytes.compiler.Compile(outputFile, format)andcompiler.CompileSvg(...)no longer copy the rendered output onto the managed heap before writing or decoding it.
- Added
compiler.CompileToDocument(...), returning a disposableTypstDocumentthat exposes the rendered output while it is still in the memory the native library allocated.GetOutputSpan,OpenOutputStream,CopyOutputTo,WriteOutputToFileandRentOutputread it without putting a multi-megabyte PDF on the large object heap;GetOutputBytescopies when abyte[]is what you need. - Added easier PDF compilation APIs on
TypstCompiler:compiler.CompilePdf(...)returning aPdfResult(with implicit conversion tobyte[],ReadOnlySpan<byte>, andReadOnlyMemory<byte>).compiler.CompilePdf(string outputFile)/compiler.CompilePdfAsync(string outputFile)for direct file saving.compiler.CompilePdf(Stream destination)/compiler.CompilePdfAsync(Stream destination)for stream output.- Static
TypstCompiler.CompilePdf(...)andTypstCompiler.CompilePdfFromFile(...)for quick one-line compilations. compiler.CompileSvg(...)andcompiler.CompilePng(...)for format-specific image export.outcome.AsPdf()andoutcome.PrimaryBufferonCompileOutcome.
- Added
includeSystemPackagestoTypstCompiler. Setting it tofalseresolves packages frompackagePathonly, so an import that is not vendored there fails instead of being downloaded from Typst Universe and compilation stays off the network. - Added support for compiling Typst documents with multiple PDF standards simultaneously (e.g.
v-1.7,a-2b, etc.) by exposing apdfStandardsparameter in theTypstCompiler.CompileAPI, leveraging the underlyingtypst-pdfcrate updates in Typst 0.15.