Recognizing Pages (ASP - JavaScript)

Take the following steps to add code to the existing project 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():

function Recognize()
{
      var nRet;         
      var 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)
         Response.Write("The engine finished recognizing the specified pages successfully" + "<BR>");
      else
         Response.Write("Error" + nRet + "in recognized specified pages" + "<BR>");         
}
         
function GetStatus()
{
      var nRet;
      LEADRasterDoc.EnableFireRecognizeStatus = true;
      nRet = LEADRasterDoc.GetStatus();
      if (nRet == 0)
         Response.Write("Recognition Time = " + LEADRasterDoc.RecognizeStatus.RecognizedTime + "<BR>" + 
               "Total Recognized Characters = " + LEADRasterDoc.RecognizeStatus.RecognizedCharacterCount + "<BR>" + 
               "Total Recognized Words = " + LEADRasterDoc.RecognizeStatus.RecognizedWordCount + "<BR>" + 
               "Total Rejected Characters = " + LEADRasterDoc.RecognizeStatus.RejectCharacterCount + "<BR>" + 
               "Total Rejected Words = " + LEADRasterDoc.RecognizeStatus.RejectWordCount + "<BR>");         
}

3.

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

Recognize();
GetStatus();

4.

Run your page to test it.

5.

Save this page to use for testing other code samples.