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 color_space;
23pub mod error;
24pub mod font_metrics;
25pub mod handler;
26pub mod interpreter;
27pub mod interpreter_state;
28pub mod lopdf_backend;
29pub mod page_geometry;
30pub mod text_renderer;
31pub mod text_state;
32pub mod tokenizer;
33
34pub use backend::PdfBackend;
35pub use char_extraction::char_from_event;
36pub use cid_font::{
37    CidFontMetrics, CidFontType, CidSystemInfo, CidToGidMap, PredefinedCMapInfo,
38    extract_cid_font_metrics, get_descendant_font, get_type0_encoding, is_subset_font,
39    is_type0_font, parse_predefined_cmap_name, parse_w_array, strip_subset_prefix,
40};
41pub use cmap::{CMap, CidCMap};
42pub use error::BackendError;
43pub use font_metrics::{FontMetrics, extract_font_metrics};
44pub use handler::{CharEvent, ContentHandler, ImageEvent, PaintOp, PathEvent};
45pub use interpreter_state::InterpreterState;
46pub use lopdf_backend::{LopdfBackend, LopdfDocument, LopdfPage};
47pub use page_geometry::PageGeometry;
48pub use pdfplumber_core;
49pub use text_renderer::{
50    RawChar, TjElement, double_quote_show_string, quote_show_string, show_string, show_string_cid,
51    show_string_with_positioning, show_string_with_positioning_mode,
52};
53pub use text_state::{TextRenderMode, TextState};
54pub use tokenizer::{Operand, Operator, tokenize};