GetRecognizedCharacters Example for Visual Basic
Private Sub Command25_Click()
Dim nRet As Integer
Dim i As Integer
Dim iFont As Integer
RasterDoc.SpellLanguageID = LANGID_ENGLISH
RasterDoc.EnableSaveResultsToMemory = False
RasterDoc.RecognitionDataFileName = "c:\test.rdf"
nRet = RasterDoc.Recognize (0, 0)
If (nRet = 0) Then
'Dim lDocumentOptions As New LTDocumentOptions
Dim nCharsCount As Long
RasterDoc.GetRecognizedCharacters (0)
nCharsCount = RasterDoc.RecognizedCharactersCount
For i = 0 To i = nCharsCount - 1
If (RasterDoc.RecognizedCharacter (i).Confidence > 900) Then
iFont = RasterDoc.RecognizedCharacter (i).Font
iFont = iFont + FONT_BOLD + FONT_UNDERLINE
RasterDoc.RecognizedCharacter(i).Font = iFont
RasterDoc.RecognizedCharacter(i).FontSize = 20
If (RasterDoc.RecognizedCharacter(i).Flags And CHAR_ENDOFWORD = CHAR_ENDOFWORD) Then
MsgBox "Last Character in the word is available at the following position" + Chr$(13) + _
"Left = " + Str(RasterDoc.RecognizedCharacter(i).Left) + Chr$(13) + _
"Top = " + Str(RasterDoc.RecognizedCharacter(i).Top) + Chr$(13) + _
"Width = " + Str(RasterDoc.RecognizedCharacter(i).Width) + Chr$(13) + _
"Height = " + Str(RasterDoc.RecognizedCharacter(i).Height) + Chr$(13) + _
"YOffset = " + Str(RasterDoc.RecognizedCharacter(i).YOffset)
MsgBox "First guess char = " + RasterDoc.RecognizedCharacter(i).GuessCode + Chr$(13) + _
"Second guess char = " + RasterDoc.RecognizedCharacter(i).GuessCode2 + Chr$(13) + _
"Third guess char = " + RasterDoc.RecognizedCharacter(i).GuessCode3
MsgBox "First Language Id = " + Str(RasterDoc.RecognizedCharacter(i).LanguageId) + Chr$(13) + _
"Second Language Id = " + Str(RasterDoc.RecognizedCharacter(i).LanguageId2) + Chr$(13) + _
"Zone Index = " + Str(RasterDoc.RecognizedCharacter(i).ZoneIndex) + Chr$(13) + _
"Cell Index = " + Str(RasterDoc.RecognizedCharacter(i).CellIndex) + Chr$(13) + _
"Space = " + Str(RasterDoc.RecognizedCharacter(i).Space) + Chr$(13) + _
"Space Error = " + Str(RasterDoc.RecognizedCharacter(i).SpaceErr)
End If
End If
Next i
RasterDoc.SetRecognizedCharacters (0)
RasterDoc.GetRecognitionResultOptions
RasterDoc.ResultOptions.Format = DOCRTF_WORD_2000
RasterDoc.GetResultOptions.FormatLevel = FORMATLEVEL_FULL
RasterDoc.ResultOptions.DocumentOptions.PaperSizeMode = SELPREDEFINED
RasterDoc.ResultOptions.DocumentOptions.PaperType = PAPER_A4
RasterDoc.ResultOptions.DocumentOptions.PaperOrientation = PAPER_ORIENT_PORTRAIT
RasterDoc.ResultOptions.DocumentOptions.Color = COL_ORIGINAL
RasterDoc.ResultOptions.DocumentOptions.EnableTextInBoxes = False
RasterDoc.ResultOptions.DocumentOptions.MarginLeft = 5
RasterDoc.ResultOptions.DocumentOptions.MarginTop = 5
RasterDoc.ResultOptions.DocumentOptions.MarginWidth = 200
RasterDoc.ResultOptions.DocumentOptions.MarginHeight = 200
RasterDoc.ResultOptions.DocumentOptions.EnablePageBreaks = True
RasterDoc.ResultOptions.DocumentOptions.TableMethod = TM_USETABS
RasterDoc.SetRecognitionResultOptions
RasterDoc.SaveDocument ("c:\\test.doc")
End If
End Sub