Expand description
§pdfraw
Layout-preserving PDF text extraction in pure Rust, inspired by pdfplumber.
The core goal is to extract text from PDFs while preserving the original spatial layout: column alignment, line breaks, right-aligned numbers in invoices and credit notes, multi-page documents, etc.
§Quick start
use pdfraw::prelude::*;
let doc = Document::open("invoice.pdf")?;
for page in doc.pages() {
let page = page?;
let text = page.extract_text_layout(&TextOptions::pdfplumber_defaults())?;
println!("--- page {} ---\n{}", page.index(), text);
}§Modules
document: top-levelDocumentand metadata.page: per-pagePagehandle with text extraction methods.char: positioned glyphChar(post-decoding).word: clusteredWordwith options.text: clustering, word extraction, layout reconstruction.error: error type and result alias.prelude: convenient re-exports.
Re-exports§
pub use crate::char::Char;pub use crate::document::Document;pub use crate::error::Error;pub use crate::error::Result;pub use crate::page::Page;pub use crate::text::options::TextOptions;pub use crate::text::options::TextOptionsBuilder;pub use crate::word::Word;pub use crate::word::WordOptions;
Modules§
- char
- Positioned glyph type.
- document
- Top-level PDF document handle.
- error
- Library error type and result alias.
- geom
- Geometry primitives: points, bounding boxes, and 2D affine matrices.
- page
- Per-page handle exposing chars, words, and text extraction.
- prelude
- Convenience re-exports of the most-used types.
- text
- Layout reconstruction and word extraction.
- word
- Word clustering: groups of adjacent
Chars on the same line.