Quickstart
Quickstart
This example recognizes a single raster image and prints the recognized text.
1. Build an OcrInput
Create an OcrInput with InputType.SingleImage and add the image path with
OcrInput.Add().
using Aspose.OCR;
var api = new AsposeOcr();
using var input = new OcrInput(InputType.SingleImage);
input.Add("scan.png");2. Recognize and read the result
Call AsposeOcr.Recognize(). The returned OcrOutput holds one RecognitionResult per image
— index [0] for a single image.
RecognitionResult result = api.Recognize(input)[0];
Console.WriteLine(result.RecognitionText);3. Read individual lines
Each recognized line is a RecognitionResult.LinesResult, with TextInLine and a
System.Drawing.Rectangle bounding box in Line.
foreach (RecognitionResult.LinesResult line in result.RecognitionLinesResult)
{
Console.WriteLine($"{line.Line}: {line.TextInLine}");
}