Skip to main content

pdfplumber_parse/
lib.rs

1//! PDF parsing backend and content stream interpreter for pdfplumber-rs.
2//!
3//! This crate implements Layer 1 (PDF parsing via pluggable backends) and
4//! Layer 2 (content stream interpretation) of the pdfplumber-rs architecture.
5//! It depends on pdfplumber-core for shared data types.
6//!
7//! # Key types
8//!
9//! - [`PdfBackend`] — Trait for pluggable PDF parsing backends
10//! - [`LopdfBackend`] — Default backend using the `lopdf` crate
11//! - [`ContentHandler`] — Trait for receiving events from content stream interpretation
12//! - [`TextState`] — PDF text state machine (fonts, matrices, positioning)
13//! - [`CMap`] — Character code to Unicode mapping (ToUnicode CMaps)
14//! - [`FontMetrics`] — Font width metrics for character positioning
15
16#![deny(missing_docs)]
17
18pub mod backend;
19pub mod char_extraction;
20pub mod cid_font;
21pub mod cmap;
22pub mod error;
23pub mod font_metrics;
24pub mod handler;
25pub mod interpreter;
26pub mod interpreter_state;
27pub mod lopdf_backend;
28pub mod page_geometry;
29pub mod text_renderer;
30pub mod text_state;
31pub mod tokenizer;
32
33pub use backend::PdfBackend;
34pub use char_extraction::char_from_event;
35pub use cid_font::{
36    CidFontMetrics, CidFontType, CidSystemInfo, CidToGidMap, PredefinedCMapInfo,
37    extract_cid_font_metrics, get_descendant_font, get_type0_encoding, is_subset_font,
38    is_type0_font, parse_predefined_cmap_name, parse_w_array, strip_subset_prefix,
39};
40pub use cmap::{CMap, CidCMap};
41pub use error::BackendError;
42pub use font_metrics::{FontMetrics, extract_font_metrics};
43pub use handler::{CharEvent, ContentHandler, ImageEvent, PaintOp, PathEvent};
44pub use interpreter_state::InterpreterState;
45pub use lopdf_backend::{LopdfBackend, LopdfDocument, LopdfPage};
46pub use page_geometry::PageGeometry;
47pub use pdfplumber_core;
48pub use text_renderer::{
49    RawChar, TjElement, double_quote_show_string, quote_show_string, show_string, show_string_cid,
50    show_string_with_positioning, show_string_with_positioning_mode,
51};
52pub use text_state::{TextRenderMode, TextState};
53pub use tokenizer::{Operand, Operator, tokenize};