Table of Contents

Class TesseractOcrEngine

Namespace
NAPS2.Ocr
Assembly
NAPS2.Sdk.dll

OCR engine using Tesseract (https://github.com/tesseract-ocr/tesseract).

public class TesseractOcrEngine : IOcrEngine
Inheritance
TesseractOcrEngine
Implements

Methods

Bundled(string)

Gets a TesseractOcrEngine instance configured to use the Tesseract executable from the NAPS2.Tesseract.Binaries nuget package using language data .traineddata files in the specified folder.

public static TesseractOcrEngine Bundled(string languageDataPath)

Parameters

languageDataPath string

Returns

TesseractOcrEngine

BundledWithModes(string)

Gets a TesseractOcrEngine instance configured to use the Tesseract executable from the NAPS2.Tesseract.Binaries nuget package using language data .traineddata files in the specified folder. The folder is expected to have subfolders named "best" and "fast" with the actual .trainneddata files that will be used based on the OcrMode.

public static TesseractOcrEngine BundledWithModes(string languageDataBasePath)

Parameters

languageDataBasePath string

Returns

TesseractOcrEngine

Custom(string, string?)

Gets a TesseractOcrEngine instance configured to use the specified Tesseract executable, optionally looking for .traineddata files in the specified folder.

public static TesseractOcrEngine Custom(string tesseractExePath, string? languageDataPath = null)

Parameters

tesseractExePath string
languageDataPath string?

Returns

TesseractOcrEngine

CustomWithModes(string, string)

Gets a TesseractOcrEngine instance configured to use the specified Tesseract executable using language data .traineddata files in the specified folder. The folder is expected to have subfolders named "best" and "fast" with the actual .trainneddata files that will be used based on the OcrMode.

public static TesseractOcrEngine CustomWithModes(string tesseractExePath, string languageDataBasePath)

Parameters

tesseractExePath string
languageDataBasePath string

Returns

TesseractOcrEngine

ProcessImage(ScanningContext, string, OcrParams, CancellationToken)

public Task<OcrResult?> ProcessImage(ScanningContext scanningContext, string imagePath, OcrParams ocrParams, CancellationToken cancelToken)

Parameters

scanningContext ScanningContext
imagePath string
ocrParams OcrParams
cancelToken CancellationToken

Returns

Task<OcrResult>

System()

Gets a TesseractOcrEngine instance configured to use the Tesseract executable on the system PATH with the system-installed language data.

public static TesseractOcrEngine System()

Returns

TesseractOcrEngine

Events

OcrError

public event EventHandler<OcrErrorEventArgs>? OcrError

Event Type

EventHandler<OcrErrorEventArgs>?

OcrTimeout

public event EventHandler? OcrTimeout

Event Type

EventHandler?