Expand description
A naive Rust Library that provides a way to work with Typst document and PDF file programmatically.
§Overview
You can use this library to:
- compile a Typst file to a PDF or PNG file
- format a Typst file
- update metadata of a PDF file
- set permission of a PDF file
- watch for changes in the input Typst file along with its dependencies and recompile it when a change is detected
§Supported Typst Version
Version 0.14.2 (December 3, 2025)
This crate is for my personal use and Typst/Rust learning purposes; it is not affiliated with the Typst project.
§Feature flags
Below is a list of available feature flags. The crate does not define a default feature, so if
you’re unsure what you need, specify full, which enables all capabilities and fonts.
However, be aware that this will result in longer compilation times and a larger binary size.
§Capabilities
compile: Enables the [compile()], [list_fonts()] functions, and [PdfStandard] enum.format: Enables the [format()] function.pdf_metadata: Enables the [update_metadata()] function.pdf_permission: Enables the [set_permission()] function.watch: Enables the [watch()] function. This feature also enables thecompilefeature.
§Fonts Embedding
embed_additional_fonts: embed all fonts listed below.embed_cmu_roman: Computer Modern Romanembed_ia_writer_duo: iA Writer Duoembed_noto_emoji: Noto Emojiembed_noto_sans_jp: Noto Sans JPembed_noto_serif_jp: Noto Serif JPembed_recursive: Recursive Sans & Monoembed_source_code_pro: Source Code Proembed_warpnine_mono: Warpnine Monoembed_warpnine_sans: Warpnine Sans Condensed
Note that:
- typst-cli defaults are always embedded.
- The crate won’t search system fonts to ensure the reproducibility. All fonts you need should
be explicitly added via [
CompileParams::font_paths].
Functions§
- typst_
version - Returns the Typst version the library was compiled with.
- version
- Returns the version of the library.