stet-pdf-reader
PDF parser and renderer. Reads PDF files and converts pages to display lists for rendering.
This crate has no dependency on stet-core — it depends only on stet-fonts
and stet-graphics, making it usable independently of the PostScript interpreter.
Rendering Correctness
The display list produced by stet-pdf-reader preserves overprint, spot
colors, knockout groups, and ICC-based CMYK blend math — features most
lightweight PDF renderers drop because they don't affect on-screen preview.
Combined with binary clip coverage in the stet-render backend, this makes
the output suitable for prepress and proofing, not just viewing. See the
repository README
for detail.
Contents
PdfDocument— Main entry point: parse a PDF, enumerate pages, render to display lists- Parser — PDF object parser, cross-reference table, incremental updates
- Filters — FlateDecode, LZWDecode, ASCII85Decode, ASCIIHexDecode, RunLengthDecode, DCTDecode, JPXDecode, CCITTFaxDecode, JBIG2Decode
- Crypto — PDF encryption (RC4, AES-128, AES-256)
- Content interpreter — PDF page content stream → display list conversion
- Font handling — Type 1, TrueType, CFF, CID fonts with encoding/CMap support
Features
| Feature | Default | Description |
|---|---|---|
jpx |
yes | JPEG 2000 (JPXDecode) via hayro-jpeg2000 |
render |
yes | render_page_to_rgba() via stet-render |
Usage
use PdfDocument;
let data = read?;
let doc = from_bytes?;
println!;
for page in 0..doc.page_count
Acknowledgements
JPEG 2000, JBIG2, and CCITT-Fax stream decoding use the
hayro-jpeg2000,
hayro-jbig2, and
hayro-ccitt crates from the
hayro PDF renderer by Laurenz
Stampfl. These are the best pure-Rust decoders available for those three
PDF stream filters, and stet-pdf-reader would not support the full PDF
stream-filter surface without them. Thanks to the hayro project for
factoring them out as reusable crates.
License
Apache-2.0 OR MIT