问题描述
public void ReadTextFromImage(String ImagePath)
{
try
{
Label lb = new Label();
// //从图像中抓取文本
MODI.Document ModiObj = new MODI.Document();
ModiObj.Create(ImagePath);
ModiObj.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH,true,true);
/ /检索从图像中收集的文本
MODI.Image ModiImageObj =(MODI.Image)ModiObj.Images [0];
Label1 .Text =(ModiImageObj.Layout.Text);
string ss = ModiImageObj.Layout.Text;
$ / $
//从Modi.Document的Images集合中获取第一个MODI.Image对象
MODI.Layout l ayout = ModiImageObj.Layout; //获取Modi.Image对象的Layout属性
// ...
//对从中获取的对象做一些事情MODI
ModiObj.Close();
}
catch(例外情况)
{
抛出新例外(ex.Message);
}
}
此代码将在安装Microsoft Office Document Imaging时在本地计算机中正常运行。 />
我在网上得到这个错误
检索COM类工厂对于CLSID {40942A6C-1520-4132-BDF8-BDC1F71F547B}的组件由于以下错误而失败:8004015 4。
public void ReadTextFromImage(String ImagePath)
{
try
{
Label lb = new Label();
// // Grab Text From Image
MODI.Document ModiObj = new MODI.Document();
ModiObj.Create(ImagePath);
ModiObj.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);
//Retrieve the text gathered from the image
MODI.Image ModiImageObj = (MODI.Image)ModiObj.Images[0];
Label1.Text = (ModiImageObj.Layout.Text);
string ss = ModiImageObj.Layout.Text;
// get the first MODI.Image object from Modi.Document's Images collection
MODI.Layout layout = ModiImageObj.Layout; // get the Layout property of the Modi.Image object
// ...
// do something with the objects gained from MODI
ModiObj.Close();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
This Code will run Proper in Local Machine While installing Microsoft Office Document Imaging.
I get this error on online
"Retrieving the COM class factory for component with CLSID {40942A6C-1520-4132-BDF8-BDC1F71F547B} failed due to the following error: 80040154".
这篇关于FTP服务器上的OCR问题(在线)使用MODI DLL时此代码将在本地计算机中正常运行安装Microsoft Office Document Imaging时。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!