mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-09 12:32:52 +00:00
The web build has no model files: it downloads them. `Ocr::from_bytes` loads the pair only when each file's SHA-256 matches ATTRIBUTION.toml (rten's ONNX parser can spin forever on bytes that aren't a model), and `OcrsRecognizer::from_ocr` wraps the result as an engine that stays available without files. The web build's workers send what they read back as JSON: `lines_to_json` / `lines_from_json` carry each word's box and, when it has one, its confidence; the reader credits the words to the engine the worker ran, and refuses anything else (a missing or non-finite number, too many words) with an error.
27 lines
787 B
TOML
27 lines
787 B
TOML
[package]
|
|
name = "pdfcraft-ocr"
|
|
description = "Scan & OCR: recognise text in page images (ocrs) and write it as an invisible, searchable text layer"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
repository.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
pdfcraft-fonts = { workspace = true }
|
|
ocrs = { version = "0.13.1", default-features = false, features = ["rten"] }
|
|
rten = { version = "0.26.0", default-features = false, features = ["onnx_format", "rten_format"] }
|
|
serde_json.workspace = true
|
|
sha2 = "0.11"
|
|
thiserror.workspace = true
|
|
|
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
|
# The page image is handed to the external tesseract process as a PNG.
|
|
png = "0.18"
|
|
|
|
[dev-dependencies]
|
|
tempfile = "3.27"
|