Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust crate reference

pdfboss is a workspace of focused crates, all sharing one version. Add the ones you need with cargo add; each crate's API reference lives on docs.rs.

CrateResponsibilityDocs
pdfboss-corePDF syntax, objects, filters, cross-references and document model (ISO 32000)docs.rs
pdfboss-textFont loading, encodings, ToUnicode CMaps and text extractiondocs.rs
pdfboss-outputLayout analysis and output rendering: plain text and markdowndocs.rs
pdfboss-encodingShared font encoding tables and glyph-name mappings (ISO 32000 Appendix D)docs.rs
pdfboss-jpxCleanroom JPEG 2000 (JPXDecode) decoder (ITU-T T.800)docs.rs
pdfboss-iccCleanroom ICC profile parser and colour transform (ICC.1:2010)docs.rs
pdfboss-renderPage rasterization to RGBA pixmaps and PNG, plus embedded-image extractiondocs.rs
pdfboss-writePDF creation: COS object writer, content canvas, composed elements (text, paragraph, image, link), outlines, attachments, page labels, viewer preferences, XMP metadata and document assemblydocs.rs
pdfboss-styleCSS-subset themes for document compositiondocs.rs
pdfboss-markdownCommonMark+GFM composed into themed PDFsdocs.rs
pdfboss-aioAsync, range-fetching PDF access: huge files, many documents, remote HTTP sourcesdocs.rs
pdfboss-cliThe pdfboss command-line tooldocs.rs
pdfboss-tuiTerminal explorer for PDF internals: element tree, object inspector, hex view, page preview and Markdown previewdocs.rs
pdfboss-pyPyO3 extension module pdfboss._pdfboss, built with maturinnot on crates.io; ships as the pdfboss wheel

A further workspace member, pdfboss-testkit, is an internal PDF fixture builder for the test suite; it is not published.

Where to start

  • Reading a document: pdfboss_core::Document (open, load, and their _with_password twins), then page, page_count, metadata, version.
  • Text and markdown: pdfboss_output::{extract_text, extract_markdown}; positioned styled spans via pdfboss_text::extract_spans.
  • Rasterizing: pdfboss_render::{render_page, render_page_with_options, render_page_reporting} and Pixmap::save_png; embedded images via extract_page_images.
  • Creating: pdfboss_write::{Pdf, Page, Canvas, Content}; see Creating PDFs.
  • Composing Markdown: pdfboss_markdown::to_pdf with a pdfboss_style::Theme; see Markdown to PDF.
  • Async and HTTP sources: pdfboss_aio::AsyncDocument (open, open_url, from_bytes); see Async and remote documents.
  • Element iteration: pdfboss_core::Document::elements(ElementOpts), a lazy iterator over physical and logical elements, and the async AsyncDocument::elements, which returns an ElementStream; see Exploring PDF internals.

The guide chapters carry compiled examples for each of these; the Quickstart has the shortest end-to-end one.