Method RunAsync
- Namespace
- LMKit.Extraction.Ocr
- Assembly
- LM-Kit.NET.dll
RunAsync(OcrParameters, CancellationToken)
Executes the OCR process using the provided parameters. Concrete subclasses must override this method to implement specific OCR logic (e.g., calling a third‐party OCR library).
public abstract Task<OcrResult> RunAsync(OcrParameters ocrParameters, CancellationToken cancellationToken = default)
Parameters
ocrParameters
OcrParametersAn OcrParameters instance that encapsulates the image buffer, any associated attachment metadata, and any additional configuration options.
cancellationToken
CancellationTokenA CancellationToken that can be used to cancel the OCR operation at any time.
Returns
- Task<OcrResult>
A Task<TResult> that, when completed, provides an OcrResult containing the extracted text, layout information, and any other data produced by the OCR engine.
Exceptions
- OperationCanceledException
Thrown if the operation is canceled via the provided
cancellationToken
.- Exception
Concrete implementations may throw other exceptions to indicate failures in the underlying OCR processing (e.g., I/O errors, service faults, invalid image format). It is recommended to document those specifics in the subclass’s implementation.