IRONSOFTWAREHOME
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();
Imports IronOcr
Imports System.Threading

' Opens a Large PDF which may need to be cancelled early
Dim ocrTesseract As New IronTesseract() With {.Language = OcrLanguage.English}

Using ocrInput = New OcrInput()
    ocrInput.LoadPdf("large-report.pdf")

    ' Starts a read on the PDF using IronOCR
    Dim ocrRead As OcrReadTask = ocrTesseract.ReadAsync(ocrInput)

    Thread.Sleep(1000) ' Time passes...

    ' Cancellation Example:
    ocrRead.Cancel()
    ocrRead.Wait()
End Using
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,236,385Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required