Crate typwriter

Crate typwriter 

Source
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 the compile feature.

§Fonts Embedding

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.