Leadtools.Document Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
GetRecognizedWords Method
See Also  Example
Leadtools.Document Namespace > RasterDocumentEngine Class : GetRecognizedWords Method




pageIndex
Index of the page for which all of the recognized words are being retrieved. This is a zero-based index.
Returns all words that have been recognized for specific recognized page.

Syntax

Visual Basic (Declaration) 
Public Function GetRecognizedWords( _
   ByVal pageIndex As Integer _
) As IList(Of RasterDocumentRecognizedWords)
Visual Basic (Usage)Copy Code
Dim instance As RasterDocumentEngine
Dim pageIndex As Integer
Dim value As IList(Of RasterDocumentRecognizedWords)
 
value = instance.GetRecognizedWords(pageIndex)
C# 
public IList<RasterDocumentRecognizedWords> GetRecognizedWords( 
   int pageIndex
)
Managed Extensions for C++ 
public: IList<RasterDocumentRecognizedWords>* GetRecognizedWords( 
   int pageIndex
) 
C++/CLI 
public:
IList<RasterDocumentRecognizedWords>^ GetRecognizedWords( 
   int pageIndex
) 

Parameters

pageIndex
Index of the page for which all of the recognized words are being retrieved. This is a zero-based index.

Example

Visual BasicCopy Code
Public Sub GetRecognizedWordsExample()
   ' Note that this is a sample key, which will not work in your toolkit
   RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey")

   Dim rasterDocument As RasterDocumentEngine
   rasterDocument = RasterDocumentEngine.Instance
   rasterDocument.Startup()
   'assume page is added, refer to AddPage example for more information
   'assume zones are added, refer to AddZone example or FindZones for more information
   'assume page is recognized, refer to Recognize example for more information

   Dim recogWords As IList(Of RasterDocumentRecognizedWords) = rasterDocument.GetRecognizedWords(0)

   Dim buffer As String
   Dim i As Integer = 0
   Do While i < recogWords.Count
      buffer = "Word = " & recogWords(i).Word & Constants.vbLf & "Zone Index = " & recogWords(i).ZoneIndex & Constants.vbLf & "Area {" & recogWords(i).WordArea.Left & ", " & recogWords(i).WordArea.Top & ", " & recogWords(i).WordArea.Right & ", " & recogWords(i).WordArea.Bottom & "}"

      MessageBox.Show(buffer)
      i += 1
   Loop

   rasterDocument.Shutdown()
End Sub
C#Copy Code
public void GetRecognizedWordsExample() 

   // Note that this is a sample key, which will not work in your toolkit 
   RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey"); 
 
   RasterDocumentEngine rasterDocument; 
   rasterDocument = RasterDocumentEngine.Instance; 
   rasterDocument.Startup(); 
 
   // assume page is added, refer to AddPage example for more information 
   // assume page is recognized, refer to Recognize example for more information 
 
   IList<RasterDocumentRecognizedWords> recogWords = rasterDocument.GetRecognizedWords(0); 
 
   string buffer; 
   for (int i=0; i < recogWords.Count; i++) 
   { 
      buffer = "Word = " + recogWords[i].Word  + "\n" +  
         "Zone Index = " + recogWords[i].ZoneIndex  + "\n" +  
         "Area {" + recogWords[i].WordArea.Left +  
         ", " + recogWords[i].WordArea.Top  +  
         ", " + recogWords[i].WordArea.Right +  
         ", " + recogWords[i].WordArea.Bottom + "}"; 
 
      MessageBox.Show(buffer); 
   } 
   rasterDocument.Shutdown(); 
}

Remarks

Gets all recognized words for specific recognized page. This method should be called after calling Recognize method.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Documentrequires a Document or Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features