Extracting words from the MODIDocument

  • 13 years ago

    Hi to All techies,

    I am experiencing a typical problem while extracting words from a TIFF file. I am using MODI object in C# and trying to xtract the words. The problem is I could see "DB05BHS10" in the image but when I read that word dynamically with the layout.words[0] its giving like "DROSSHSIO" Its like a puzzle to me and I am breaking my head to resolve this.

    Can any one of you help me how to extract exact word  the code that I writted as follows

    =========

    MODI.Document _MODIDocument = new MODI.Document();
    StringBuilder str = new StringBuilder();
    string filename = @"C:\ReadByOCR.tif";
    MODI.Word word = null;
    MODI.Image image = null;
    MODI.Layout layout = null;




    _MODIDocument.Create(filename);
    _MODIDocument.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);

    for (int i = 0; i < _MODIDocument.Images.Count; i++)
    {

     image = (MODI.Image)_MODIDocument.Images[i];      
     layout = image.Layout;
     for (int j = 0; j < layout.Words.Count; j++)
     {
                       
      word = (MODI.Word)layout.Words[j];
      str.Append(word.Text);





     }
    }
    MessageBox.Show(str.ToString());
    _MODIDocument.Close(false);
    System.Runtime.InteropServices.Marshal.ReleaseComObject(image);
    System.Runtime.InteropServices.Marshal.ReleaseComObject(layout);
    System.Runtime.InteropServices.Marshal.ReleaseComObject(_MODIDocument);
     ===========================






    Thanks

    Vijay

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debuggers don't remove bugs. They only show them in slow motion.”