Table of Contents

Class CommandOcrOptions

Namespace
Egami.Ocr
Assembly
Egami.dll

Options for CommandOcrEngine.

public sealed record CommandOcrOptions : IEquatable<CommandOcrOptions>
Inheritance
CommandOcrOptions
Implements
Inherited Members

Examples

// Any OCR program that writes hOCR or ALTO is an engine. No shell runs the command, and each run has its own temp folder.
CommandOcrEngine tesseract = new("tesseract {image} {output} -l {langs} --dpi {dpi} hocr", new CommandOcrOptions
{
    Languages = ["eng"],
    Timeout = TimeSpan.FromMinutes(2),
});

try
{
    OcrResult result = await tesseract.RecognizeAsync(new OcrRequest(page), Ct);
    Console.WriteLine(result.Text);
}
catch (OcrEngineException e)
{
    Console.WriteLine($"{e.Message} {e.ErrorOutput}");
}

Properties

Default

Gets the default options.

public static CommandOcrOptions Default { get; }

Property Value

CommandOcrOptions

Languages

Gets the languages the program reads, reported in Languages and used for {langs} when a request names none. Empty by default.

public IReadOnlyList<string> Languages { get; init; }

Property Value

IReadOnlyList<string>

Name

Gets the engine's name in Name, or null for the program's file name.

public string? Name { get; init; }

Property Value

string

Output

Gets what the program writes. Defaults to Auto.

public OcrOutputFormat Output { get; init; }

Property Value

OcrOutputFormat

Read

Gets the limits for reading what the program writes. Defaults to Default.

public OcrReadOptions Read { get; init; }

Property Value

OcrReadOptions

Timeout

Gets how long one run may take before the program is stopped. Defaults to 5 minutes. Must be positive.

public TimeSpan Timeout { get; init; }

Property Value

TimeSpan

WorkingDirectory

Gets the folder the program runs in, or null for the run's own temporary folder.

public string? WorkingDirectory { get; init; }

Property Value

string