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.
| Crate | Responsibility | Docs |
|---|---|---|
pdfboss-core | PDF syntax, objects, filters, cross-references and document model (ISO 32000) | docs.rs |
pdfboss-text | Font loading, encodings, ToUnicode CMaps and text extraction | docs.rs |
pdfboss-output | Layout analysis and output rendering: plain text and markdown | docs.rs |
pdfboss-encoding | Shared font encoding tables and glyph-name mappings (ISO 32000 Appendix D) | docs.rs |
pdfboss-jpx | Cleanroom JPEG 2000 (JPXDecode) decoder (ITU-T T.800) | docs.rs |
pdfboss-icc | Cleanroom ICC profile parser and colour transform (ICC.1:2010) | docs.rs |
pdfboss-render | Page rasterization to RGBA pixmaps and PNG, plus embedded-image extraction | docs.rs |
pdfboss-write | PDF creation: COS object writer, content canvas, composed elements (text, paragraph, image, link), outlines, attachments, page labels, viewer preferences, XMP metadata and document assembly | docs.rs |
pdfboss-style | CSS-subset themes for document composition | docs.rs |
pdfboss-markdown | CommonMark+GFM composed into themed PDFs | docs.rs |
pdfboss-aio | Async, range-fetching PDF access: huge files, many documents, remote HTTP sources | docs.rs |
pdfboss-cli | The pdfboss command-line tool | docs.rs |
pdfboss-tui | Terminal explorer for PDF internals: element tree, object inspector, hex view, page preview and Markdown preview | docs.rs |
pdfboss-py | PyO3 extension module pdfboss._pdfboss, built with maturin | not 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_passwordtwins), thenpage,page_count,metadata,version. - Text and markdown:
pdfboss_output::{extract_text, extract_markdown}, each taking aReadingOrder(Content,StructureTree,Geometric); positioned styled spans viapdfboss_text::extract_spans; where each image is drawn, without decoding it, viapdfboss_text::placed_images. - Rasterizing:
pdfboss_render::{render_page, render_page_with_options, render_page_reporting}andPixmap::save_png; embedded images viaextract_page_images. - Creating:
pdfboss_write::{Pdf, Page, Canvas, Content}; see Creating PDFs. - Composing Markdown:
pdfboss_markdown::to_pdfwith apdfboss_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 asyncAsyncDocument::elements, which returns anElementStream; see Exploring PDF internals. - Forms, bookmarks and attachments:
Document::{interactive_form, form_fields, outline, named_destinations, page_labels, embedded_files, embedded_file_data, viewer_preferences}, each with a*_with(src, trailer)twin for an async source (pdfboss_core::{form_fields_with, outline_with, ...}); see Reading forms, bookmarks and attachments. - Document-level structures:
pdfboss_core::{linearization_dictionary, output_intents_with, articles_with, page_beads_with}and the page thumbnail, piece-info and presentation readers under the same naming. - Structure tree:
pdfboss_core::StructureTree(load_with,place_with,place_items_with,content_items_with, andcontent_item_counts_withfor a summary count that reads no element) andDocument::content_items(&page), a page's marked-content sequences and tagged annotations in tree order; see Annotations in the reading order. - Editing existing files:
pdfboss_write::{merge_documents, split_document, rotate_rewrite, rewrite_document, encrypt_document, decrypt_document}for a fresh document through theImporter,pdfboss_write::{split_runs, split_part, copy_pages_with}to build one part at a time, synchronously from aDocumentor from anyAsyncObjectSourceinto any byte sink, andpdfboss_write::{Update, rotate_pages, set_metadata_with, watermark}for an incremental update; see Editing PDFs, Assembling documents and Encrypted PDFs.
The guide chapters carry compiled examples for each of these; the Quickstart has the shortest end-to-end one.