ReadAsync 方法的毫秒超时参数提供了一个可选的毫秒超时,在此之后 OCR 读取操作将被取消。
与使用 CancellationToken 类似,ReadAsync 超时参数也有助于在程序或应用程序卡住的情况下读取大型输入文件。
请注意,.NET Framework 4.xx 不支持此功能。
探索使用 IronOCR 在 C# 中进行异步 OCR 处理using IronOcr;
int cancel_time = 1000;
// Opens a Large PDF which may need to be cancelled early
IronTesseract ocrTesseract = new IronTesseract() { Language = OcrLanguage.English };
var ocrInput = new OcrInput();
ocrInput.LoadPdf("large-report.pdf");
// Starts a read on the PDF using IronOCR with specified cancel time
OcrReadTask ocrRead = ocrTesseract.ReadAsync(ocrInput, cancel_time);
ocrRead.Wait();
Imports IronOcr
Dim cancel_time As Integer = 1000
' Opens a Large PDF which may need to be cancelled early
Dim ocrTesseract As New IronTesseract() With {.Language = OcrLanguage.English}
Dim ocrInput = New OcrInput()
ocrInput.LoadPdf("large-report.pdf")
' Starts a read on the PDF using IronOCR with specified cancel time
Dim ocrRead As OcrReadTask = ocrTesseract.ReadAsync(ocrInput, cancel_time)
ocrRead.Wait()Imports IronOcr
Dim cancel_time As Integer = 1000
' Opens a Large PDF which may need to be cancelled early
Dim ocrTesseract As New IronTesseract() With {.Language = OcrLanguage.English}
Dim ocrInput = New OcrInput()
ocrInput.LoadPdf("large-report.pdf")
' Starts a read on the PDF using IronOCR with specified cancel time
Dim ocrRead As OcrReadTask = ocrTesseract.ReadAsync(ocrInput, cancel_time)
ocrRead.Wait()ReadAsync 方法的毫秒超时参数提供了一个可选的毫秒超时,在此之后 OCR 读取操作将被取消。
与使用 CancellationToken 类似,ReadAsync 超时参数也有助于在程序或应用程序卡住的情况下读取大型输入文件。
请注意,.NET Framework 4.xx 不支持此功能。
探索使用 IronOCR 在 C# 中进行异步 OCR 处理NuGet 下载量 6,411,693|版本:2026.11刚刚发布