Skip to main content

pdf_ocr/
lib.rs

1#![warn(missing_docs)]
2//! OCR integration for scanned PDFs with pluggable engine support.
3
4// Copyright (c) 2026 Innovation Trigger B.V.
5//
6// PDFluent is available under two licences, at your option: the GNU AGPLv3, or
7// the PDFluent Commercial Licence. See the LICENSE file in this repository --
8// that file travels with the copy you received, which a URL does not.
9
10pub mod engine;
11pub mod error;
12/// Integrity checking for anything fetched over the network. Compiled always,
13/// feature flags or not, so its tests cannot be skipped out of CI.
14pub mod integrity;
15pub mod pipeline;
16
17#[cfg(feature = "tesseract")]
18pub mod tesseract;
19
20#[cfg(feature = "tesseract-cli")]
21pub mod tesseract_cli;
22
23#[cfg(feature = "paddle")]
24pub mod paddle;
25
26/// The ONE shared ONNX Runtime layer for the opt-in model tiers: resolution,
27/// checksums, one-time init, version check, session cache. Pin: ort
28/// =2.0.0-rc.13, api-23, ONNX Runtime 1.23.2, loaded dynamically.
29///
30/// Always compiled: the specs, the failure types and the path resolution are
31/// plain Rust, so a build without the tier still reports a missing model with
32/// the typed [`ModelError`](runtime::ModelError) rather than a string. Only
33/// the session half (`init`, `builder`, `session`, `SharedSession`) needs the
34/// `onnx-runtime` feature and the `ort` crate.
35pub mod runtime;
36
37pub use engine::{NoOpEngine, OcrEngine, OcrPageResult, OcrWord};
38pub use error::{OcrError, Result};
39pub use pipeline::{make_searchable, OcrConfig, OcrPageReport, OcrReport};
40
41#[cfg(feature = "tesseract")]
42pub use tesseract::TesseractEngine;
43
44#[cfg(feature = "tesseract-cli")]
45pub use tesseract_cli::{TesseractCliEngine, TesseractCliError};
46
47#[cfg(feature = "paddle")]
48pub use paddle::PaddleOcrEngine;