1

I'm trying to read an image with MODI (using c#), I followed many of the links that I found on the Internet.

As I can solve the problem "COMException not be controlled" by running the following code:

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;
    }

I tried to submit the block in a try-cach capturing the exception

'System.Runtime.InteropServices.COMException'

but remains the same.

I have also tried to debug the program, I have found that the exception only spear the following line:

md.OCR(MiLANGUAGES.miLANG_SPANISH, false, false);

Please, you know where it can be happening?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Pekee
  • 177
  • 1
  • 8

0 Answers0