Installation
Python
pip install pdfboss
Prebuilt abi3 wheels for CPython 3.12 and later; no Rust toolchain required. The wheel compiles in the predefined CJK CMap set, so CJK-coded documents extract out of the box.
Rendering with fonts="full" substitutes replacement faces for fonts the PDF
does not embed. Those faces ship as a separate package, pulled in by the
full extra:
pip install "pdfboss[full]"
This installs pdfboss-fonts alongside the wheel. Without it, fonts="full"
requires a font_dir argument pointing at faces of your own. See
Rendering pages.
CLI
cargo install pdfboss-cli
This installs the pdfboss binary. Two features are on by default:
substitute-fonts: bundles the OFL Croscore substitute faces (about 4 MB) sorenderandtuican paint text for PDFs with non-embedded fonts out of the box.predefined-cmaps: compiles in the predefined CJK CMap set of ISO 32000 Table 118 (about 830 KB) sotextreads Shift-JIS/EUC/Big5/GBK/UHC-coded Type0 fonts.
Opt out of both for a leaner binary:
cargo install pdfboss-cli --no-default-features
Rust crates
The library crates are on crates.io:
cargo add pdfboss-core pdfboss-text pdfboss-output pdfboss-render pdfboss-write pdfboss-markdown pdfboss-aio
| Crate | Responsibility |
|---|---|
pdfboss-core | Parsing, object model, stream filters, document and page tree |
pdfboss-text | Fonts, encodings, positional text spans |
pdfboss-output | Layout analysis to plain text and Markdown |
pdfboss-render | Rasterization to RGBA pixmaps and PNG, embedded-image extraction |
pdfboss-write | PDF creation |
pdfboss-markdown | CommonMark+GFM composed into themed PDFs (pulls in pdfboss-style) |
pdfboss-aio | Async, range-fetching document access |
Add only what you use: pdfboss-core alone parses; the others build on it.
The library crates keep their optional features off by default:
pdfboss-rendersubstitute-fonts: the bundled substitute faces.pdfboss-corepredefined-cmaps: the predefined CJK CMap set.pdfboss-aiohttp: remote documents over HTTP range requests.pdfboss-aiowrite: streaming created documents into tokio writers; shipsTokioSink, which presents anytokio::io::AsyncWritetoPdf::write_into_with(see Creating PDFs).
Enable a feature at add time, for example:
cargo add pdfboss-aio --features http
Building from source
git clone https://github.com/4thel00z/pdfboss
cd pdfboss
cargo build --release # the CLI lands at target/release/pdfboss
cargo test --workspace # Rust test suite
The Python extension builds with maturin into the active virtualenv:
maturin develop # build the extension into your venv
pytest # Python integration tests
Next: the Quickstart.