Recognizing Pages (ASP - VBScript)

Take the following steps to add code to the existing page that will let you recognize pages:

1.

Start with the program you created in Working with Pages

2.

Add the following code to the file before the call to AddPage():

Sub Recognize()
      Dim nRet
      Dim LANGID_ENGLISH

      LANGID_ENGLISH = 0         
      LEADRasterDoc.SpellLanguageID = LANGID_ENGLISH
      LEADRasterDoc.EnableSubSystem = True
      LEADRasterDoc.EnableCorrection = True

      LEADRasterDoc.RecognitionDataFileName = "D:\Ocr\LETTER.TIF"

      nRet = LEADRasterDoc.Recognize(0, 1)
      If (nRet = 0) Then
         Response.Write "The engine finished recognizing the specified pages successfully" + "<BR>"
      Else
         Response.Write "Error" + CStr(nRet) + "in recognized specified pages" + "<BR>"
      End If
End Sub      

Sub GetStatus()
      Dim nRet
      nRet = LEADRasterDoc.GetStatus()
      If (nRet = 0) Then
         Response.Write "Recognition Time = " + CStr(LEADRasterDoc.RecognizeStatus.RecognizedTime) + "<BR>" + _
               "Total Recognized Characters = " + CStr(LEADRasterDoc.RecognizeStatus.RecognizedCharacterCount) + "<BR>" + _
               "Total Recognized Words = " + CStr(LEADRasterDoc.RecognizeStatus.RecognizedWordCount) + "<BR>" + _
               "Total Rejected Characters = " + CStr(LEADRasterDoc.RecognizeStatus.RejectCharacterCount) + "<BR>" + _
               "Total Rejected Words = " + CStr(LEADRasterDoc.RecognizeStatus.RejectWordCount) + "<BR>"
      End If
End Sub

 

3.

Add the following code before the call to RemovePage():

Recognize
GetStatus

 

6.

Run your page to test it.

5.

Save this page to use for testing other code samples.