Skip to content

v2.3.2

Choose a tag to compare

@FarhanLodi FarhanLodi released this 16 Aug 08:50
· 18 commits to main since this release

feat: v2.3.0 — thirteen new capabilities, hosted TrOCR, PDF thread-safety

Adds thirteen features on top of the EasyOCR parity work, plus the fixes
and hardening that testing them surfaced. Everything is additive and
opt-in: no public method was renamed and no existing default changed, so
a service configured as before behaves exactly as before.

Recognition detail

  • RecognitionOptions.WordLevelDetail (default None) populates
    OcrLine.Words/Characters with true per-word and per-character geometry
    derived from the recognizer's CTC alignment rather than estimated from
    character counts. hOCR/ALTO/TSV emit real word boxes when present and
    fall back to the previous approximation when not.

Documents

  • Unicode searchable PDF: embedded Type0/CIDFontType2 Identity-H subset
    font with a ToUnicode CMap, so CJK/Arabic/Devanagari/Thai output is
    genuinely searchable. No font is bundled — supply one via
    PdfOcrOptions.TextLayerFontPath or rely on the system-font probe, with
    graceful Latin-1 fallback reported by PdfOcrResult.TextLayerFontStatus.
  • Multi-frame TIFF input, batch and streaming, with the pixel-flood guard
    applied per frame and a MaxFrames bound.
  • Recovered tables as data: TableHtmlParser plus ToRows/ToDataTable/ToCsv,
    expanding merged cells and tolerating malformed markup.

New recognition modes

  • Handwriting via TrOCR (ViT encoder + autoregressive decoder, greedy and
    beam decoding, byte-level BPE). Models are hosted alongside the
    printed-text packs and download on first use, checksum-verified;
    Quantize (default true) selects int8 (~520 MB) over full precision
    (~1.5 GB). Point the three paths at your own export to download nothing.
  • Barcode and QR reading via ZXing.Net, including a combined
    text-and-barcode pass. ZXing types never surface in the public API.

Post-processing

  • Redaction that permanently paints over matched text, with Luhn-checked
    card and mod-97 IBAN presets and rotated-quad fills.
  • SymSpell-style post-OCR correction gated on confidence, with IBAN/MRZ
    checksum repair.
  • Anchor-based field extraction with invoice/receipt presets.
  • CER/WER accuracy metrics (EasyOcrSharp.Evaluation).

Integration surfaces

  • Streaming ExtractTextStreamAsync (IAsyncEnumerable).
  • src/EasyOcrSharp.Cli: an easyocrsharp dotnet tool with scan/pdf/
    models/info. Results on stdout, diagnostics on stderr, exit codes
    0/1/2/130. Mobile natives are trimmed from the tool package (157 MB to
    64 MB) since a CLI can never execute an Android .aar or iOS xcframework.
  • samples/EasyOcrSharp.WebApi: minimal-API service with bounded
    concurrency, upload limits, problem-details errors and a Dockerfile.

Fixed

  • PDF rasterization was not thread-safe. Docnet exposes PDFium through a
    process-wide DocLib.Instance singleton and PDFium is not thread-safe,
    but the rasterizer called into it unsynchronized — so OCR-ing two PDFs
    at once could return a corrupted page. Native calls are now serialized;
    OCR stays outside the gate so documents still overlap.
  • A completed model download was reported twice when the final chunk
    landed on a reporting tick, making consumers double-count the tail.
  • CLI --preprocess was not repeatable, silently discarding all but the
    last value while --lang kept every one.
  • The TrueType subsetter produced fonts its own parser rejected: a
    CIDFontType2 subset legitimately carries no cmap.

Tests

  • 303 to 973 (913 unit, 4s; full suite green). New coverage for the CLI
    (parser, binding, input resolution, output routing, console/progress),
    barcodes, table export, evaluation, correction, field extraction, and
    concurrent PDF rasterization.
  • Model-backed classes now share one non-parallel xUnit collection.
    Fourteen classes each building their own ONNX sessions concurrently
    exhausted the allocator (OnnxRuntimeException: bad allocation), which
    showed up as a PDF assertion failing roughly one run in three.
  • Accuracy regression gate activated with a ground-truth fixture.

Dependencies

  • Added ZXing.Net 0.16.11.
  • ONNX Runtime 1.27.0 to 1.29.0; Microsoft.Extensions.* 10.0.9 to 10.0.11
    (aligned across library, tests and demo to avoid an NU1605 downgrade).