TesseractOcrEngineOptions class
Namespace: PdfNetStack.Ocr.Tesseract
Assembly: PdfNetStack.Ocr.Tesseract.dll
Package: PdfNetStack
Settings for TesseractOcrEngine.
public sealed class TesseractOcrEngineOptionsInheritance
object ← TesseractOcrEngineOptions
Properties
Section titled “Properties”The resolution to tell Tesseract about. Null lets it estimate one from the text, as the images come from pages of any resolution.
public int? Dpi { get; init; }Property Value
Section titled “Property Value”int?
ExecutablePath
Section titled “ ExecutablePath”The tesseract executable. Null looks for it in the absolute folders of the PATH, never in the current folder. Name the program itself rather than a script around it: on .NET Framework a timeout or cancellation kills only the process started, so anything it started keeps running. .NET 8 and later kill the whole tree.
public string? ExecutablePath { get; init; }Property Value
Section titled “Property Value”LanguageMap
Section titled “ LanguageMap”What a requested language means to Tesseract. By default latin is eng and
arabic is ara, so that PdfOcrOptions works unchanged. A name not
listed here goes to Tesseract as it is.
public IReadOnlyDictionary<string, string> LanguageMap { get; init; }Property Value
Section titled “Property Value”IReadOnlyDictionary<string, string>
Languages
Section titled “ Languages”The languages to check for when loading, as they will be requested: the names in
LanguageMap or Tesseract’s own, such as fra or eng+ara.
Loading fails when the data for one is missing.
public IReadOnlyList<string> Languages { get; init; }Property Value
Section titled “Property Value”MaxConcurrentProcesses
Section titled “ MaxConcurrentProcesses”Processes running at once; further calls wait their turn. Each process holds the image and the language data in memory.
public int MaxConcurrentProcesses { get; init; }Property Value
Section titled “Property Value”MaxOutputBytes
Section titled “ MaxOutputBytes”The output one image may produce before its process is killed and TesseractOcrException is thrown.
public long MaxOutputBytes { get; init; }Property Value
Section titled “Property Value”PageSegmentationMode
Section titled “ PageSegmentationMode”Tesseract’s page segmentation mode: 3 is automatic layout without orientation detection. 0 and 2 give no text and are refused.
public int PageSegmentationMode { get; init; }Property Value
Section titled “Property Value”TessdataPath
Section titled “ TessdataPath”The folder holding the .traineddata files. Null leaves it to Tesseract: TESSDATA_PREFIX, else where it was installed.
public string? TessdataPath { get; init; }Property Value
Section titled “Property Value”ThreadsPerProcess
Section titled “ ThreadsPerProcess”Threads each process may use, through OMP_THREAD_LIMIT. The default of 1 suits
PdfOcr, which already reads pages in parallel. 0 leaves it to Tesseract.
public int ThreadsPerProcess { get; init; }Property Value
Section titled “Property Value”Timeout
Section titled “ Timeout”The time one image may take before its process is killed and TimeoutException is thrown.
public TimeSpan Timeout { get; init; }