Skip to main content

Module ocr

Module ocr 

Source
Expand description

OCR backend trait and implementations.

§OCR Backend Extension

The OcrBackend trait is public. Callers can implement their own backends for specific use cases:

  • ocrs (this crate, ocr feature): pure-Rust Tesseract-style engine. WASM-compatible. Requires external model files (.rten format).

  • Mistral OCR (ocr-mistral feature): blocking HTTP adapter to Mistral’s cloud OCR API.

  • Google Vision (ocr-google feature): blocking HTTP adapter to Google Cloud Vision’s images:annotate OCR endpoint.

  • AWS Textract (ocr-aws feature): blocking HTTP adapter to Amazon Textract’s DetectDocumentText endpoint.

  • Azure Document Intelligence (ocr-azure feature): blocking HTTP adapter to the prebuilt-read model.

  • Paddle ONNX (ocr-onnx feature): adapter around pdf-ocr’s PaddleOCR engine.

  • Custom: implement OcrBackend directly for proprietary or cloud-based OCR flows.

Structs§

AwsTextractBackend
Blocking HTTP OCR backend for AWS Textract.
AzureDocIntelBackend
Blocking HTTP OCR backend for Azure AI Document Intelligence.
GoogleVisionBackend
Blocking HTTP OCR backend for Google Cloud Vision.
MistralOcrBackend
Blocking HTTP OCR backend for the Mistral OCR API.
OcrResult
Result of recognizing text in a single image.
OcrWord
A single recognized word.
OcrsBackend
Pure-Rust OCR backend backed by the ocrs engine (which uses ONNX models via rten).
PaddleOnnxBackend
OCR backend backed by pdf-ocr’s PaddleOCR ONNX pipeline.

Enums§

OcrError
Errors returned by an OcrBackend.

Traits§

OcrBackend
Pluggable OCR backend.

Functions§

best_available_backend
Return the first available OCR backend in priority order.
ocr_page_default
Run OCR on a rendered page image using the default ocrs backend.