AspBucket offers ASP.NET, C#, VB, Jquery, CSS, Ajax, SQL tutorials. It is the best place for programmers to learn

Thursday, 15 December 2016

How to use Modi OCR To extract text from the image?

Microsoft Office Document Imaging(MODI) has been discontinued with MS Office 2010. However, we can use this dll to read text from image if you are using MS Office version below than Office 2010.
Please check blow code for read text from image file.

  private string ExtractTextFromImage(string filePath)
    {
            Document modiDocument = new Document();
            modiDocument.Create(filePath);
            modiDocument.OCR(MiLANGUAGES.miLANG_ENGLISH);
            MODI.Image modiImage = (modiDocument.Images[0] as MODI.Image);
            string extractedText = modiImage.Layout.Text;
            modiDocument.Close();
            return extractedText;
    }

Pass file path as a parameter in above method. It will return the image text as an output.

0 comments :

Post a Comment

  • Popular Posts
  • Comments