Expand description
§typstgen
Compile an existing .typ file to PDF using an embedded Typst engine —
no external typst binary, no subprocess. Template resolution is
config-driven (see Config) rather than hardcoded.
Usable as a CLI (cli feature), a Rust library (always), and from
JavaScript via Wasm (wasm feature).
ⓘ
use typstgen::{compile, Config};
let config = Config::load(None)?;
let pdf_bytes = compile("example.typ".as_ref(), &config)?;
std::fs::write("example.pdf", pdf_bytes)?;Re-exports§
pub use config::Config;pub use error::Error;pub use error::Result;pub use options::CompileOptions;pub use options::PageRange;pub use options::PdfStandard;
Modules§
- config
- Config-driven template path resolution.
- error
- The error type returned by every fallible typstgen function.
- options
- Per-compilation options:
sys.inputsand PDF export settings.
Structs§
- Output
- A compiled PDF together with the warnings Typst reported.
Functions§
- compile
- Compile a
.typfile to PDF bytes using the embedded Typst engine. - compile_
with_ options - Like
compile_with_warnings, withsys.inputsand PDF export settings fromCompileOptions. - compile_
with_ warnings - Like
compile, but also returns Typst’s warnings.