提问人:Andy 提问时间:5/2/2023 最后编辑:Andy 更新时间:5/2/2023 访问量:175
需要在 C 语言中从 IronOCR 发布 PDF 文件#
Need to Release PDF File From IronOCR in C#
问:
我正在使用 IronOCR 从使用 C# 放置在文件夹中的 pdf 中提取文本。我正在运行一个进程,该进程等待将 pdf 放入文件夹中,然后运行以下代码。
var ocr = new IronTesseract();
using (var input = new OcrInput(pdfFileToProcess))
{
input.Deskew();
input.Binarize();
var ocrResult = ocr.Read(input);
textFromOCRResult = ocrResult.Text;
}
示例 pdfFileToProcess 可以是 d:\TestOCR\C01.pdf。
当它运行时,它一次工作得很好。但是,当我将相同或另一个PDF放入该文件夹中时,会出现以下错误。这就像 IronOCR 不会放过 PDF 文件一样。
System.IO.IOException: 'The process cannot access the file 'D:\TestOCR\C01.pdf' because it is being used by another process.'
此错误指向代码行
using (var input = new OcrInput(pdfFileToProcess))
答: 暂无答案
评论