Skip to content

v3.2.0 — PP-OCRv5 engine, PDF text layers, data extraction and line-grouping fixes

Latest

Choose a tag to compare

@FarhanLodi FarhanLodi released this 15 Nov 05:31

EasyOcrSharp 3.2.0 adds an opt-in PP-OCRv5 engine for plain OCR, options for hard pages, reading of born-digital PDF text, and helpers for pulling data out of results. The default EasyOCR engine is unchanged, every new feature is opt-in, and no public type moved. Three defaults change behaviour; see Behaviour changes below.

Install

dotnet add package EasyOcrSharp --version 3.2.0
dotnet add package EasyOcrSharp.Gpu --version 3.2.0     # optional, CUDA
dotnet tool update -g EasyOcrSharp.Cli --version 3.2.0  # CLI

Highlights

Opt-in PP-OCRv5 engine

  • RecognitionOptions.Engine = RecognitionEngine.PpOcrV5 runs ExtractTextFromImage, ExtractTextStreamAsync, RecognizeRegionsAsync and DetectRegionsAsync on PaddleOCR's PP-OCRv5 detector and recognizers. Results come back as the same OcrResult types.
  • On the 100-page test corpus it finds as much text as the default engine and runs about 2.7× faster. It is much stronger on tables, multi-language pages, signs and scanned forms.
  • It is weaker on rotated or perspective-distorted pages; pair it with DocumentOrientation or DetectOrientation. Measure it on your own documents before switching.
  • Not supported on this engine: bn, as, mni, kn, vi and custom recognizers.

Hard pages (both engines)

  • DetectionOptions.TileLargeImages: detects text in very large pages, such as long receipts and wide banners, in full-resolution tiles.
  • DetectionOptions.MinTextHeight: magnifies pages with small text, such as screenshots, faxes and low-DPI photos.
  • DetectionOptions.EnhanceContrast: helps with faded or unevenly lit scans.
  • PreprocessingOptions.CorrectNonSquarePixels: corrects fax pages with non-square pixels (e.g. 204×98 DPI). On by default.
  • OcrResult.DeskewAngle: reports the rotation that deskew applied.

PDF

  • PdfOcrOptions.TextLayer (Ignore / PreferEmbedded / Auto): reads born-digital pages straight from their embedded text, exact and at confidence 1.0, with a quality check that falls back to OCR when the embedded text is unusable.
  • PdfOcrOptions.AutoDpi: chooses the render DPI for each page.
  • ExtractTextFromPdfPagesAsync: streams pages one at a time.
  • New Stream overloads for ExtractTextFromPdfAsync and CreateSearchablePdfAsync.

Data extraction (EasyOcrSharp.Extraction)

  • FindMatches with built-in OcrPatterns: e-mail, URL, phone, date, amount, IBAN, card number and percentage, each returned with its position on the page.
  • MrzParser: reads passport and ID-card MRZ zones (ICAO 9303 TD1/TD2/TD3) and verifies the check digits.
  • ToLayoutText: produces layout-preserving text output.
  • RecognizeZonesAsync: reads named template zones from a page.
  • GetQuality / GetLinesForReview: summarize confidence and flag lines that need checking.
  • EasyOcrModels.DownloadAsync / CheckCache: pre-download models and verify the model cache, for offline or CI deployments.

Runtime and CLI

  • EasyOcrServiceOptions.AllowIntraOpSpinning and CudnnConvAlgoSearch.
  • New CLI options on scan and pdf: --engine easyocr|ppocrv5, --text-layer ignore|prefer|auto, --dpi auto.

Fixes

  • Consecutive lines merged into one unreadable box. On tightly set pages and on slightly rotated scans, separate lines could be grouped into a single garbled line. Lines are now joined by their fitted slope. Strongly tilted lines are cut along that slope, while level lines keep the box they had before.
  • Deskew coordinates. With Preprocessing.Deskew, line, word and character boxes now land on your input image instead of the internal deskew canvas. Region combined with Deskew now works correctly.
  • Word and character boxes now follow their line when Region or DetectOrientation is used.
  • Cancellation now stops image decoding on every input path and surfaces as OperationCanceledException.

Document structure engine

AnalyzeDocumentAsync now mirrors PaddleOcrNet 2.2.0–2.4.0:

  • Lines outside any layout block are no longer dropped; they are kept in StructureResult.OrphanLines.
  • With several scripts in play, the recognizer for the right script is chosen more reliably. For example, Cyrillic text is no longer read as Latin look-alikes.
  • Faster post-processing, concurrent recognition, and a warm-up that removes the slow first request.

Behaviour changes

  • PreprocessingOptions.CorrectNonSquarePixels is on by default. It only affects images whose metadata declares non-square pixels; set it to false for the old behaviour.
  • With Preprocessing.Deskew, boxes are now on the image you passed in. Remove any offset compensation you added for the old behaviour.
  • StructureResult.ToJson() adds an OrphanLines array on pages that have such lines.
  • CLI: --dpi 0 now means auto DPI; it used to be rejected.

Dependencies

EasyImageSharp 1.2.0 · Microsoft.ML.OnnxRuntime 1.31.1 (Gpu: Microsoft.ML.OnnxRuntime.Gpu 1.31.1) · Microsoft.Extensions.* 10.0.14 · .NET 10

Full details: CHANGELOG.md