关闭MODI文档后无法删除文件 [英] cannot delete file after closing MODI document
本文介绍了关闭MODI文档后无法删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码块通过OCR从图像中提取数据:
I am using the following code block to extract data from image through OCR:
MODI.Document tifDoc = new Document();
tifDoc.Create(Server.MapPath("~/Upload/") + fname.Split('.')[0] + ".tif");
tifDoc.OCR(MiLANGUAGES.miLANG_SYSDEFAULT, false, false);
tifDoc.Save();
MODI.Image tifImg = (MODI.Image)tifDoc.Images[0];
content += tifImg.Layout.Text;
tifDoc.Close(false);
tifDoc = null;
tifImg = null;
GC.Collect();
GC.WaitForPendingFinalizers();
但是,当我尝试删除tiff图像时,它引发了一个例外,即该进程无法访问该文件,因为该文件正在被另一个进程使用.我该怎么办?
But when i try to delete the tiff image, it throws an exception that The process cannot access the file because it is being used by another process . What do I do?
推荐答案
您必须先执行以下方法,然后再删除该文件
you have to do folloing methos before delete that file
tifDoc.dispose();
处理完该项目后,可以成功删除该项目.
after disposing that item can be deleted successfully.
这篇关于关闭MODI文档后无法删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文