跳至页脚内容

其他

探索 IronOCR 的许多其他功能--满足您所有 OCR 需求的理想库!

Icon Main related to 其他
性能提升器

2

中止令牌

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("sample.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();
C#
3

超时

防止您的应用程序挂起在困难或损坏的文件上。为任何 OCR 进程设置特定的超时时间,以确保更好的资源管理和系统稳定性。

了解如何:C# Tesseract 超时
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);
C#