Module · Regira.Office.OCR

OCR in .NET.
One contract, two engines.

Extract text from a scan, a photo of a receipt, or a page rendered out of a PDF. Both engines answer the same interface, so switching between them is a registration change and a different set of language data.

← All Office modules

§ 01The contract

What every provider gives you.

The interfaces below are the part that does not change when you swap the library underneath. Each provider then adds whatever extras its own library exposes.

01

Read

IOcrService takes a file and returns an OcrResult carrying the recognised text. That is the whole surface.

02

Languages

Tesseract takes a language code and a data directory; PaddleOCR takes the language per call. Both handle multilingual documents.

03

Preprocess first

Cropping, deskewing and flattening to grayscale with the Drawing API before the read is usually what moves accuracy, not the engine.

04

Scanned PDFs

Render pages to images with the PDF module, then read those — the two modules exchange the same file objects.

Interfaces
IOcrServiceOcrResult
§ 02Providers

2 published implementations.

Install the one that fits your runtime and licensing, and name it once at registration. Every package here is published on nuget.org.

PaddleOCRTesseract
§ 03In code

Inject the interface. Name the provider once.

The provider appears where the concrete class is constructed, and nowhere else. Always-current samples live in the package documentation.

Extract text from a scanC#
// Tesseract runs anywhere; PaddleOCR is the Windows alternative behind the same contract.
var ocr = new Regira.Office.OCR.Tesseract.OcrManager(new OcrManager.Options
{
    Language      = "en",
    DataDirectory = "./tessdata"
});

OcrResult result = await ocr.Read(scan);
string? text = result.Text;
§ 04Without .NET

The same thing, over HTTP.

Extract text from an uploaded image using Tesseract, with support for multiple languages.

Call it from any language.

The free tier needs no key and is rate-limited to 5 requests / 60 s. A trial or commercial key removes the limit — send it in the X-License-Key header.

Also explore

PDF

Generate PDFs from HTML, merge and split them, extract text and render pages as images — over DocNET, SelectPdf, Spire, Playwright or PuppeteerSharp.