【问题标题】:C# OCR tiff with MODI only ocr's the first pageC# OCR tiff with MODI only ocr's the first page
【发布时间】:2013-08-10 01:52:57
【问题描述】:

我使用 MODI 是为了在我的一个应用程序中实现 ocr,并且每次我提供 tiff 时,由于某种原因,它只 ocrs tiff 的第一页。那是我的代码: 公共字符串 OCR(字符串路径) {

        try
        {
            var md = new MODI.Document();
            md.Create(path);
            md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);
            var image = (MODI.Image)md.Images[0];
            return image.Layout.Text;
        }
        catch (Exception ee)
        {
            if (ee.Message.ToLower() == "ocr running error")
                return ee.Message + ". No text found";
            else
                return " OCR not available. You need to have office installed.";
        }

    }

我想我在某个地方需要一个循环,但究竟如何?

提前致谢

【问题讨论】:

    标签: ocr tiff modi


    【解决方案1】:

    大概是这样的:

    StringBuilder sb = new StringBuilder();
    
    foreach (MODI.Image image in md.Images) {
        sb.Append(image.Layout.Text);
    }
    
    //or
    
    //for (int i = 0; i < md.Images.Count; i++) {
    //    sb.Append(md.Images[i].Layout.Text);
    //}
    
    return sb.ToString();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-05-12
      • 2022-12-27
      • 2018-05-30
      • 1970-01-01
      • 1970-01-01
      • 2021-11-14
      • 1970-01-01
      相关资源
      最近更新 更多