Browse our Products

Latest release

Deprecation warning

What was changed

KeySummaryCategory
OCRNET‑811Enabled recognition process cancellation.New feature
OCRNET‑815Added recognition of Arabic text.New feature

Public API changes and backwards compatibility

This section lists all public API changes introduced in Aspose.OCR for .NET 24.4.0 that may affect the code of existing applications.

Added public APIs:

No changes.

Updated public APIs:

The following public APIs have been changed in Aspose.OCR for .NET 24.4.0 release:

Language enumeration

Aspose.OCR for .NET can now recognize Arabic texts, including texts in mixed Arabic/English:

ValueAlphabet
Aspose.OCR.Language.AraArabic

Recognize(OcrInput images, RecognitionSettings settings, CancellationToken cancellationToken)

An optional cancellationToken parameter was added to Recognize() method. This allows passing a cancellation token which can be used to forcibly stop the long recognition process either manually or automatically after the specified number of milliseconds.

Removed public APIs:

No changes.

Examples

The code samples below illustrate the changes introduced in this release:

Recognize Arabic text

// Initialize Aspose.OCR for .NET recognition API
Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
// Add image
Aspose.OCR.OcrInput input = new Aspose.OCR.OcrInput(Aspose.OCR.InputType.SingleImage);
input.Add("source.png");
// Set recognition language
Aspose.OCR.RecognitionSettings recognitionSettings = new Aspose.OCR.RecognitionSettings();
recognitionSettings.Language = Aspose.OCR.Language.Ara;
// Recognize image
List<Aspose.OCR.RecognitionResult> results = recognitionEngine.Recognize(input, recognitionSettings);
Console.WriteLine(results[0].RecognitionText);

Automatically cancel recognition after 20 seconds

// Set automatic cancellation after 20 seconds (20,000ms)
CancellationTokenSource cancellationTokenSource  = new CancellationTokenSource();
cancellationTokenSource.CancelAfter(20000);
// Initialize Aspose.OCR for .NET recognition API
Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
// Add scanned PDF to recognition batch
Aspose.OCR.OcrInput input = new Aspose.OCR.OcrInput(Aspose.OCR.InputType.PDF);
input.Add("large.pdf");
// Recognize image
List<Aspose.OCR.RecognitionResult> results = recognitionEngine.Recognize(input, null, cancellationTokenSource.Token);