我正在尝试使用 MODI(使用 c#)读取图像,我遵循了我在 Internet 上找到的许多链接。
因为我可以通过运行以下代码来解决“COMException not be controlled”的问题:
public string reconeixNom(string filePath)
{
String nom;
Document md = new Document(); //Crea document MODI.Document
md.Create(filePath); //Document amb la ruta que toca.
md.OCR(MiLANGUAGES.miLANG_SPANISH, false, false);
MODI.Image image = (MODI.Image)md.Images[0];
nom = image.Layout.Text;
image = null;
md.Close(false);
md = null;
GC.Collect();
GC.WaitForPendingFinalizers();
return nom;
}
我试图在捕获异常的 try-cach 中提交块
'System.Runtime.InteropServices.COMException'
但保持不变。
我也尝试过调试程序,我发现异常只出现在以下行:
md.OCR(MiLANGUAGES.miLANG_SPANISH, false, false);
请问,你知道它可能发生在哪里吗?