Expand description
Core PDF machinery: syntax, objects, filters, cross-references, the document model, and lazy element iteration (physical file structure with byte spans plus logical document structure), implemented from the PDF specification (ISO 32000).
Re-exports§
pub use annotation::action_with;pub use annotation::annotations_with;pub use annotation::document_additional_actions_with;pub use annotation::page_additional_actions_with;pub use annotation::Action;pub use annotation::ActionKind;pub use annotation::Annotation;pub use annotation::AnnotationFlags;pub use annotation::AnnotationState;pub use annotation::Border;pub use annotation::Markup;pub use annotation::Relationship;pub use annotation::ReplyType;pub use annotation::Target;pub use annotation::TargetAnnotation;pub use annotation::TargetPage;pub use annotation::Trigger;pub use annotation::TriggeredAction;pub use annotation::WindowsLaunch;pub use annotation::MAX_ACTIONS;pub use annotation::MAX_TARGET_DEPTH;pub use article::articles_with;pub use article::page_beads_with;pub use article::ArticleThread;pub use article::Bead;pub use cmap::cid_to_unicode;pub use cmap::type0_encoding;pub use cmap::CidCmap;pub use cmap::CidToUnicode;pub use cmap::Type0Encoding;pub use crypt::crypt_filter_refs;pub use crypt::direct_crypt_filters;pub use crypt::Decryptor;pub use crypt::Encryptor;pub use crypt::Permissions;pub use crypt::PERMISSION_NAMES;pub use date::Date;pub use destination::destination_value_with;pub use destination::destination_with;pub use destination::named_destination_with;pub use destination::named_destinations_with;pub use destination::Destination;pub use destination::DestinationPage;pub use destination::Fit;pub use document::content_stream_data_with;pub use document::decoded_stream_data_with;pub use document::map_pages;pub use document::map_pages_forking;pub use document::page_content_with;pub use document::Document;pub use document::DocumentSeed;pub use document::Metadata;pub use document::Page;pub use elements::Element;pub use elements::ElementOpts;pub use elements::Span;pub use elements::XrefKind;pub use embedded_file::embedded_file_data_with;pub use embedded_file::embedded_files_with;pub use embedded_file::file_spec_data_with;pub use embedded_file::file_spec_with;pub use embedded_file::spec_components;pub use embedded_file::EmbeddedFile;pub use embedded_file::FileSpec;pub use error::Error;pub use error::Result;pub use extension::extensions_with;pub use extension::DeveloperExtension;pub use form::form_fields_with;pub use form::interactive_form_with;pub use form::AppearanceCharacteristics;pub use form::ButtonKind;pub use form::CaptionPosition;pub use form::ChoiceOption;pub use form::DefaultAppearance;pub use form::FieldFlags;pub use form::FieldType;pub use form::FormField;pub use form::InteractiveForm;pub use form::Quadding;pub use form::Signature;pub use form::SignatureFlags;pub use form::Widget;pub use geom::Matrix;pub use geom::Point;pub use geom::Rect;pub use hash::FastMap;pub use hash::FastSet;pub use hash::FxHasher;pub use language::language_with;pub use language::LanguageTag;pub use legal::legal_attestation_with;pub use legal::LegalAttestation;pub use linearization::linearization_dictionary;pub use linearization::Linearization;pub use measure::measure_from;pub use measure::viewports_with;pub use measure::FractionFormat;pub use measure::LabelPosition;pub use measure::Measure;pub use measure::NumberFormat;pub use measure::Viewport;pub use names::name_tree_root_with;pub use names::named_with;pub use names::names_with;pub use names::NameTree;pub use object::Dict;pub use object::Name;pub use object::ObjRef;pub use object::Object;pub use object::Stream;pub use oc::optional_content_groups_with;pub use oc::OcEvent;pub use oc::OcGroup;pub use oc::OcState;pub use oc::OcUsage;pub use outline::outline_with;pub use outline::OutlineItem;pub use output_intent::output_intents_with;pub use output_intent::OutputIntent;pub use page_label::page_label;pub use page_label::page_labels_with;pub use page_label::LabelStyle;pub use page_label::PageLabel;pub use permission::permission_handlers_with;pub use permission::PermissionHandlers;pub use piece_info::document_piece_info_with;pub use piece_info::piece_info_with;pub use piece_info::PagePiece;pub use presentation::presentation_with;pub use presentation::Dimension;pub use presentation::Motion;pub use presentation::Presentation;pub use presentation::Transition;pub use presentation::TransitionDirection;pub use presentation::TransitionStyle;pub use requirement::requirements_with;pub use requirement::Requirement;pub use requirement::RequirementHandler;pub use separation_info::separation_info_with;pub use separation_info::SeparationInfo;pub use source::block_on;pub use source::resolve_sync_with;pub use source::resolve_with;pub use source::AsyncObjectSource;pub use source::BoxFuture;pub use source::Immediate;pub use source::ObjectSource;pub use source::MAX_RESOLVE_DEPTH;pub use structure::AttributeObject;pub use structure::ContentItem;pub use structure::MarkedContentId;pub use structure::PlacedItem;pub use structure::Placement;pub use structure::StandardKind;pub use structure::StandardOwner;pub use structure::StandardType;pub use structure::StructureElement;pub use structure::StructureTree;pub use thumbnail::thumbnail_with;pub use thumbnail::Thumbnail;pub use viewer_preferences::viewer_preferences_with;pub use viewer_preferences::Direction;pub use viewer_preferences::Duplex;pub use viewer_preferences::NonFullScreenPageMode;pub use viewer_preferences::PageBoundary;pub use viewer_preferences::PrintScaling;pub use viewer_preferences::ViewerPreferences;
Modules§
- annotation
- Annotations (ISO 32000-1 §12.5) and actions (§12.6), read as data: the
entries every annotation dictionary shares, the markup entries, the
state a reply sets, a link’s destination, an attachment’s file
specification, and action dictionaries with their
/Nextchains and the trigger events that name them. No action is ever executed. - article
- Article threads (ISO 32000-1 §12.4.3): the catalog’s
/Threadsarray, each thread’s information dictionary and its chain of beads. - cmap
- CID CMap parsing and code splitting for composite (Type0) fonts
(ISO 32000-1 §9.7.5-9.7.6):
begincodespacerangedrives variable-width code splitting,begincidrange/begincidcharmap codes to CIDs,usecmaplayers a CMap over another, and/WModeselects the writing mode. The value domain is codes to CID integers — distinct from the ToUnicode CMaps parsed inpdfboss-text, whose destinations are text. - content
- Content-stream operator parsing (ISO 32000 §8/§9), including inline images. Lenient: unknown operators and arity mismatches are skipped (the operand stack is cleared), never an error.
- crypt
- Decryption for the Standard security handler (ISO 32000 §7.6), opened with the user or the owner password (the empty user password opens transparently).
- date
- Date strings (ISO 32000-1 §7.9.4):
D:YYYYMMDDHHmmSSOHH'mm', read leniently intoDateand written back, or formatted as ISO 8601 for XMP and display. - destination
- Destinations (ISO 32000-1 §12.3.2): the page a link, outline item or action shows and how that page is fitted in the window, given explicitly as an array (§12.3.2.2) or by name (§12.3.2.3).
- document
- The document model: loading, object resolution with caching, the lazily-flattened page tree with attribute inheritance, and document metadata.
- elements
- Lazy iteration over a document’s elements: the physical file structure (header, indirect objects, cross-reference sections, trailer, startxref, eof) with byte spans, and the logical document structure (pages, fonts, images, annotations, content operators). ISO 32000 §7.5 (file structure) and §7.7 (document structure).
- embedded_
file - File specifications and embedded files (ISO 32000-1 §7.11.2 to §7.11.4):
the strings and dictionaries that name a file, and the streams that
carry a file’s bytes inside the document, listed through the catalog’s
/EmbeddedFilesname tree. - error
- Error and result types shared across all pdfboss crates.
- extension
- The developer extensions the catalog declares (ISO 32000-1 §7.12): the
/Extensionsdictionary, one developer extensions dictionary per registered developer prefix, each naming the PDF version it extends and the developer’s extension level. - filters
- Stream filters (ISO 32000 §7.4): FlateDecode, LZWDecode, ASCIIHexDecode,
ASCII85Decode, RunLengthDecode, CCITTFaxDecode, JBIG2Decode, plus PNG/TIFF
predictors.
DCTDecodeandJPXDecodeare passthrough (decoded at the image layer),Cryptis a no-op (the document’s decryptor applied it when the object was loaded), and unknown names are unsupported. - form
- The document’s interactive form (ISO 32000-1 §12.7): the catalog’s
/AcroFormdictionary, which names the root fields and carries the defaults their widgets are drawn with. - geom
- Planar geometry shared by text extraction and rendering: points,
axis-aligned rectangles, and 2-D affine transformation matrices using the
PDF row-vector convention
[x y 1] · M. - hash
- A fast, non-cryptographic hasher for the small keys PDF machinery hashes
in bulk: dictionary names (
/Type,/Font, …), object ids(num, gen), and glyph indices. The standard library’s defaultHashMapuses SipHash-1-3, which is DoS-resistant but far slower than necessary for this data — the keys are short, the maps are in-process, and the input has already been parsed, so hash-flooding is not a concern here. - language
- The document’s natural language (ISO 32000-1 §14.9.2): the catalog’s
/Lang, the default for every piece of text a structure element or a marked-content sequence does not tag with a language of its own. - legal
- Legal content attestations (ISO 32000-1 §12.8.5): the catalog’s
/Legaldictionary, which counts the content a certifying signature could not vouch for and carries the signer’s attestation about it. - lexer
- Byte-level tokenizer for PDF syntax (ISO 32000 §7.2/§7.3), zero-copy where possible.
- linearization
- The linearization parameter dictionary (ISO 32000-1 Annex F.3): the first object of a linearized file, read as data. Nothing here uses the hint streams or the first-page section to load pages early.
- measure
- Measurement properties (ISO 32000-1 §12.9): a page’s
/VPviewports, each a rectangle with a measure dictionary that maps user space to real-world distances, read as data with the tables’ defaults filled in. - names
- The document’s name dictionary (ISO 32000-1 §7.7.4): the catalog’s
/Namesentry, whose entries are the roots of name trees, one per category of object that can be referred to by name. - object
- The PDF object model: the nine basic object types plus indirect references (ISO 32000 §7.3).
- objstm
- Object streams (ISO 32000 §7.5.7): compressed objects stored inside a
/Type/ObjStmstream. - oc
- Optional-content visibility (ISO 32000-1 §8.11): which optional content
groups the document’s default configuration and its usage application
dictionaries turn off, whether content gated by an
/OCentry or aBDC /OCspan is visible, and the groups themselves read as data. - outline
- The document outline (ISO 32000-1 §12.3.3): the tree of items a viewer shows as a table of contents, each with a title, an open or closed state, a destination or action, and its children.
- output_
intent - Output intents (ISO 32000-1 §14.11.5): the catalog’s
/OutputIntentsarray, read as data. Rendering does not apply a destination profile. - page_
label - Page labels (ISO 32000-1 §12.4.2): the labelling ranges of the catalog’s
/PageLabelsnumber tree, and the label each page shows. - parser
- Object parser built on the
Lexer, including indirect objects and streams (ISO 32000 §7.3.8/§7.3.10). - permission
- Permissions (ISO 32000-1 §12.8.4): the catalog’s
/Permsdictionary, one signature dictionary per permission handler, read as data. - piece_
info - Page-piece dictionaries (ISO 32000-1 §14.5): the private product data a
/PieceInfoentry holds on the catalog, a page or a form XObject, read as data and left uninterpreted. - presentation
- Presentations (ISO 32000-1 §12.4.4): a page’s display duration and its transition dictionary, read as data with the table’s defaults filled in.
- pretty
- Human-readable, indented pretty-printing of PDF objects.
- requirement
- Document requirements (ISO 32000-1 §12.10): the catalog’s
/Requirementsarray, one dictionary per feature a reader needs to show the document as intended. - separation_
info - Separation dictionaries (ISO 32000-1 §14.11.4): a page’s
/SeparationInfo, which names the colorant a pre-separated page prints and the other pages of the same separation set. - source
- The object-source abstraction shared by the synchronous and asynchronous APIs.
- structure
- Structure-tree reading order (ISO 32000-1 §14.7): where a page’s marked-content sequences sit in the document’s logical structure, so a tagged page can be read in the order its author declared, and which structure type the element holding each sequence declares (§14.7.3).
- thumbnail
- Thumbnail images (ISO 32000-1 §12.3.4): a page’s
/Thumbimage XObject, read as a stream with the entries the clause makes significant. - tree
- Name trees and number trees (ISO 32000-1 §7.9.6 and §7.9.7): sorted
key-value maps spread over
/Kidsnodes, each labelled with the/Limitsits keys fall in, so one key can be found without reading the whole tree, or every pair listed leaf by leaf. - viewer_
preferences - The viewer preferences the catalog declares (ISO 32000-1 §12.2): how a
reader should present the document on the screen and in print, read
from the catalog’s
/ViewerPreferencesdictionary (Table 150). - xref
- Cross-reference loading (ISO 32000 §7.5): classic tables, xref streams,
hybrid files (
/XRefStm),/Prevchains, and a whole-file recovery scan when everything else fails.