Class CommandOcrOptions
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
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
Name
public string? Name { get; init; }
Property Value
Output
Gets what the program writes. Defaults to Auto.
public OcrOutputFormat Output { get; init; }
Property Value
Read
Gets the limits for reading what the program writes. Defaults to Default.
public OcrReadOptions Read { get; init; }
Property Value
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
WorkingDirectory
Gets the folder the program runs in, or null for the run's own temporary folder.
public string? WorkingDirectory { get; init; }