@dornick/parsers-ocr
v0.1.0
Published
Lazy Tesseract.js OCR parser for Dornick. Extracts text from image uploads (JPEG, PNG) in the browser.
Readme
@dornick/parsers-ocr
Lazy Tesseract.js OCR parser for Dornick — extract text from image uploads in the browser.
For receipts, screenshots, ID photos, scanned forms — anywhere a photo carries text. Bypasses the multimodal token cost for OCR-shaped extraction.
Install
npm i @dornick/parsers-ocrDepends on tesseract.js. The full WASM + English training data is ~5 MB and loads on first parse.
Use
import { Dornick } from "@dornick/core";
import { tesseractParser, tesseractParserFor } from "@dornick/parsers-ocr";
const dornick = new Dornick({ config, transport });
dornick.parsers.add(tesseractParser); // English default
dornick.parsers.add(tesseractParserFor("fra")); // French
dornick.parsers.add(tesseractParserFor(["eng", "deu"])); // multi-langPaths produced
| Path | Content |
|---|---|
| text.txt | Plain extracted text |
| ocr.json | { text, confidence, words: [{ text, confidence, x0, y0, x1, y1 }] } |
The ocr.json includes per-word bounding boxes — useful for layout-aware extraction (receipts, IDs).
Capability gate
requires: ["wasm"] — runs anywhere WebAssembly is supported. Performance is meaningfully better on browsers with wasm.simd and wasm.threads; without those, expect 2-5× slower OCR on the same image.
Pairs nicely with
@dornick/parsers-pdf— for image-only scanned PDFs (combine: pdf.js extracts images, OCR extracts text).@dornick/mounts-media(planned) — forCameraMountcapture → OCR pipelines.
See also
License
MIT — © Dipankar Sarkar
