# pdf-rs

> Rust library to read, manipulate and write PDF files.

Source: https://talira.ai/catalog/pdf-rs-p2j8k7qt
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [documents / pdf / manipulation](https://talira.ai/categories/documents/pdf/manipulation), [languages / rust](https://talira.ai/categories/languages/rust)
- Licence: MIT[^3][^4]
- Pricing: Free and open source[^3][^4]
- Free tier: yes[^3][^4]
- Self-hostable: yes[^3]

pdf-rs (the `pdf` crate) is a low-level Rust library that reads PDF files into typed objects (catalog, page tree, pages, fonts, XObjects, annotations, forms, the structure tree) and decodes content streams into a list of operators. Objects are resolved lazily and streams are decoded only when asked for, encrypted files open with a user or owner password (RC4 and AES), and strict or tolerant parsing modes choose how much broken input to accept. Its documentation maps each module to the clause of PDF 32000-1 it implements. Writing is the least mature part, and rendering and text extraction live in the project's separate pdf_render and pdf_text crates.

## Links

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

## Problems it solves

- read the objects inside a PDF from Rust: pages, fonts, images and annotations
- walk the drawing operators in a PDF page's content stream in Rust
- open a password-protected PDF in Rust with the user or owner password
- pull embedded images and fonts out of a PDF file in Rust
- parse PDFs from untrusted users with limits that guard against decompression bombs
- read a PDF's interactive form fields and annotations in Rust
- inspect a PDF's cross-reference table, object streams and incremental updates
- lazily load only the parts of a large PDF that my Rust code needs
- append an incremental update to an existing PDF from Rust

## Features

- typed views of PDF objects: catalog, pages, fonts, XObjects, colour spaces, annotations, forms, structure tree
- content streams decoded into an Op enum
- lazy object resolution and stream decoding, with optional caching and memory mapping
- stream filters and predictors
- RC4 and AES decryption with the standard security handler
- strict and tolerant parsing modes, with an object size limit against decompression bombs
- cross-reference tables and streams, object streams and incremental updates
- building a document from scratch and importing objects into it
- documentation mapped to PDF 32000-1 clauses

## Limitations

- Doesn't render PDF pages to images: rendering is in the separate pdf_render crate[^1][^2]
- Doesn't extract text: text extraction is in the separate pdf_text and pdf_render crates[^1][^2]
- Doesn't repair broken PDFs: it can parse damaged files tolerantly but has no repair[^1]
- Can't rewrite an arbitrary existing PDF yet: writing is experimental, and only building from scratch and incremental updates work[^1][^2]

## Capabilities

- Has official SDKs: plan not known

## Trust

Overall: 0.15 out of 1.
Signals: backing 0.00, extensibility 0.00.

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [hayro](https://talira.ai/catalog/hayro-aqyrj3a8.md): A set of Rust crates for parsing, interpreting and rendering PDF files.
- [lopdf](https://talira.ai/catalog/lopdf-8dj842a3.md): A Rust library for PDF document manipulation.
- [pdfium-render](https://talira.ai/catalog/pdfium-render-yyd0t2g5.md): A high-level idiomatic Rust wrapper around Pdfium, the C++ PDF library used by the Google Chromium project.

## Sources

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