IRONSOFTWAREHOME
中止令牌
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
中止令牌

中止令牌

该功能允许用户将当前线程暂停指定的毫秒数时间。

这有助于在程序或应用程序运行时出现卡住的情况下读取大型输入文件。

使用 IronOCR 探索异步 OCR 操作。
在 GitHub 上查看

准备开始了吗?

Nuget Downloads 6,236,385版本:2026.9刚刚发布

Key in blue circle

立即获取免费的 30 天试用版密钥

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
获取您的无义务咨询
填写下面的表格或通过sales@ironsoftware.com
您的资料将始终保密。
深受全球数百万工程师信赖
Iron Software 的客户徽标
立即获取您的免费30 天试用密钥
无需信用卡或创建账户