I already reference the MODI v12 library and use the following sample code. But when I run the project, it shows me an error at "miDoc.Images(0).OCR" with error message: Object hasn't been initialised and can't be used yet.
Actually I'm doing a simple project that input a tif file and then perform the OCR process and output the tif content to a text.
For example the tif file got "ABCDEFGHIJ" then I want to use the MODI OCR to output the ABCDEFGHIJ from the TIF picture.
Anyone please help me here...
Code:Sub TestWords() Dim miDoc As MODI.Document Dim miWord As MODI.Word Dim strWordInfo As String ' Load an existing TIFF file. Set miDoc = New MODI.Document miDoc.Create "C:\document1.tif" ' Perform OCR. miDoc.Images(0).OCR ' Retrieve and display word information. Set miWord = miDoc.Images(0).Layout.Words(2) strWordInfo = _ "Id: " & miWord.Id & vbCrLf & _ "Line Id: " & miWord.LineId & vbCrLf & _ "Region Id: " & miWord.RegionId & vbCrLf & _ "Font Id: " & miWord.FontId & vbCrLf & _ "Recognition confidence: " & _ miWord.RecognitionConfidence & vbCrLf & _ "Text: " & miWord.Text MsgBox strWordInfo, vbInformation + vbOKOnly, _ "Word Information" Set miWord = Nothing Set miDoc = Nothing End Sub




Reply With Quote