# pdf-writer

> A step-by-step PDF writer.

Source: https://talira.ai/catalog/pdf-writer-1hvagsht
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [documents / pdf / generation](https://talira.ai/categories/documents/pdf/generation), [languages / rust](https://talira.ai/categories/languages/rust)
- Licence: MIT OR Apache-2.0[^2][^3]
- Pricing: Free and open source[^2][^3]
- Free tier: yes[^2][^3]
- Self-hostable: yes[^2]
- Backed by: [Typst](https://talira.ai/orgs/typst.md)

pdf-writer is a low-level Rust crate from the Typst project that writes PDF files object by object. You build the document into one internal buffer through strongly typed writers for each PDF structure (catalog, pages, content streams, fonts, images, annotations, interactive form fields, signature fields, tagged-structure elements, colour spaces and ICC profiles), and each writer finishes its object when it's dropped. It leaves the document's design to you: you choose the object IDs, write the content stream operators and make sure the result is valid. It forbids unsafe code, and the higher-level [krilla](https://talira.ai/catalog/krilla-ac5vwb68.md) crate is built on it.

## Links

- GitHub: https://github.com/typst/pdf-writer
- Docs: https://docs.rs/pdf-writer

## Problems it solves

- write PDF files from Rust with full control over every object and dictionary
- emit PDF content streams (paths, text operators, images) directly from my own layout engine
- I'm building a typesetting or report engine in Rust and need a fast PDF backend with no hidden magic
- create AcroForm fields and signature fields in a PDF I generate in Rust
- write tagged PDF structure elements for accessibility from my Rust renderer
- embed CID fonts with ToUnicode CMaps so text in my generated PDF can be copied and searched
- generate PDFs in Rust without unsafe code or C dependencies
- write ICC output intents and separation colour spaces into a PDF for print
- add outlines, named destinations and link annotations to PDFs my program writes
- low-allocation PDF serializer for a Rust document pipeline that produces many files

## Features

- strongly typed writers for pages, fonts, images, annotations, actions and more
- content stream builder for PDF drawing and text operators
- interactive form fields (AcroForm), including signature fields and seed values
- tagged PDF: structure tree, role maps, marked content and attributes
- Type 0, CID, Type 1 and Type 3 fonts, CMaps, widths and font descriptors
- colour spaces: ICC profiles, Separation, DeviceN, shading and tiling patterns, output intents
- embedded files, outlines, page labels, name and number trees, transitions and renditions
- chunks that can be written separately and renumbered
- writers deref to plain dictionaries for fields the typed API doesn't expose
- unsafe code forbidden

## Limitations

- Doesn't validate the PDF you write: it doesn't allocate object IDs or check that every required field is present, so you follow the PDF spec yourself[^1]

## Capabilities

- Has official SDKs: plan not known

## Trust

Overall: 0.27 out of 1.
Signals: backing 0.30, extensibility 0.00.

- backed by Typst

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [lopdf](https://talira.ai/catalog/lopdf-8dj842a3.md): A Rust library for PDF document manipulation.
- [krilla](https://talira.ai/catalog/krilla-ac5vwb68.md): A high-level, ergonomic Rust library for creating PDF documents.
- [ironpress](https://talira.ai/catalog/ironpress-g94sb527.md): HTML to PDF. In process. In pure Rust.

## Sources

[^1]: https://github.com/typst/pdf-writer/blob/main/src/lib.rs (checked 20 Nov 2026)
[^2]: https://crates.io/crates/pdf-writer (checked 20 Nov 2026)
[^3]: https://github.com/typst/pdf-writer/blob/main/README.md (checked 20 Nov 2026)
