Abort Token
using IronOcr;
using System.Threading;

// Opens a Large PDF which may need to be cancelled early
IronTesseract ocrTesseract = new IronTesseract() { Language = OcrLanguage.English };

using var ocrInput = new OcrInput();
ocrInput.LoadPdf("large-report.pdf");

// Starts a read on the PDF using IronOCR
OcrReadTask ocrRead = ocrTesseract.ReadAsync(ocrInput);

Thread.Sleep(1000); // Time passes...

// Cancellation Example:
ocrRead.Cancel();
ocrRead.Wait();
NuGet Download
PM > Install-Package IronOcr
Abort Token

Abort Token

The feature allows the users to suspend the current thread for a specified period in milliseconds.

This helps with reading large input files in the case that there's a stuck while the program or application is running.

Explore Asynchronous OCR Operations with IronOCR.
View on GitHub

Ready to Get Started?

Nuget Downloads 6,357,159Version:2026.11just released