Class OcrEngineException
Thrown when an OCR engine fails, such as a program that exits with an error, times out or writes no result.
public sealed class OcrEngineException : EgamiException, ISerializable
- Inheritance
-
OcrEngineException
- 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}");
}
Constructors
OcrEngineException(string, int?, string?, Exception?)
Initializes a new instance of the OcrEngineException class.
public OcrEngineException(string message, int? exitCode = null, string? errorOutput = null, Exception? innerException = null)
Parameters
messagestringWhat went wrong, as a sentence.
exitCodeint?The program's exit code, or null when no program ran or it was stopped.
errorOutputstringThe end of what the program wrote to its error output, or null.
innerExceptionExceptionThe exception that caused this one, if any.
Properties
ErrorOutput
Gets the end of what the program wrote to its error output, or null.
public string? ErrorOutput { get; }
Property Value
ExitCode
Gets the program's exit code, or null when no program ran or it was stopped.
public int? ExitCode { get; }
Property Value
- int?