1. Simplest code to OCR an image using Microsoft Office's Imaging functionality (requires MS-Office 2007 or later, imaging components must be installed and MODI must be added to references).

    private string OCR ( string fileToOCR)
    {
    MODI.Document md = new MODI.Document();

    md.Create(fileToOCR);
    md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);
    MODI.Image img = (MODI.Image) md.Images[0];
    MODI.Layout layout = img.Layout;
    layout = img.Layout;
    string result = layout.Text;
    md.Close (false);

    return result;

    }

    Calling function can be:
    private void button6_Click(object sender, EventArgs e)
    {
    MessageBox.Show ( OCR ("C:\\temp\\in.tif"));
    }
    7

    View comments

Blog Archive
Topics
Topics
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.