Leadtools.Document Deprecated as of v16. Refer to: Leadtools.Forms.Ocr | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
GetZone Method
See Also  Example
Leadtools.Document Namespace > RasterDocumentEngine Class : GetZone Method



pageIndex
Specifies the index of the page for which to get the zone information. This is a zero-based index.
zoneIndex
Specifies the index of the zone for which to get the information. This is a zero-based index.
pageIndex
Specifies the index of the page for which to get the zone information. This is a zero-based index.
zoneIndex
Specifies the index of the zone for which to get the information. This is a zero-based index.
Gets information about the zone at the specified index in the zone list of the specified page.

Syntax

Visual Basic (Declaration) 
Public Function GetZone( _
   ByVal pageIndex As Integer, _
   ByVal zoneIndex As Integer _
) As RasterDocumentZoneData
Visual Basic (Usage)Copy Code
Dim instance As RasterDocumentEngine
Dim pageIndex As Integer
Dim zoneIndex As Integer
Dim value As RasterDocumentZoneData
 
value = instance.GetZone(pageIndex, zoneIndex)
C# 
public RasterDocumentZoneData GetZone( 
   int pageIndex,
   int zoneIndex
)
C++/CLI 
public:
RasterDocumentZoneData^ GetZone( 
   int pageIndex,
   int zoneIndex
) 

Parameters

pageIndex
Specifies the index of the page for which to get the zone information. This is a zero-based index.
zoneIndex
Specifies the index of the zone for which to get the information. This is a zero-based index.

Return Value

RasterDocumentZoneData class which contains zone information for the specified zone in the specified page.

Example

Visual BasicCopy Code
Public Sub GetZoneExample()
   ' 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

   Try
      Dim _zoneData As RasterDocumentZoneData = rasterDocument.GetZone(0, 0)
      MessageBox.Show("The engine retrieved the specified zone information successfully")

      Dim zoneArea As String
      zoneArea = String.Format("Zone Area:{0}Left={1}{0}Top={2}{0}Right={3}{0}Bottom={4}", Chr(13), _zoneData.Area.Left, _zoneData.Area.Top, _zoneData.Area.Right, _zoneData.Area.Bottom)
      MessageBox.Show(zoneArea)

      _zoneData.FillMethod = RasterDocumentFillMethod.OcrA
      _zoneData.Type = RasterDocumentZoneType.Graphic

      rasterDocument.UpdateZone(0, 0, _zoneData)
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try

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

   // 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 zones are added, refer to AddZone example or FindZones for more information 
   // assume page is recognized, refer to Recognize example for more information 
 
   try 
   { 
      RasterDocumentZoneData _zoneData = rasterDocument.GetZone(0, 0); 
      MessageBox.Show("The engine retrieved the specified zone information successfully"); 
 
      String zoneArea = String.Format("Zone Area:\nLeft={0}\nTop={1}\nRight={2}\nBottom={3}", _zoneData.Area.Left, _zoneData.Area.Top, _zoneData.Area.Right, _zoneData.Area.Bottom); 
      MessageBox.Show(zoneArea); 
 
      _zoneData.FillMethod = RasterDocumentFillMethod.OcrA; 
      _zoneData.Type = RasterDocumentZoneType.Graphic; 
 
      rasterDocument.UpdateZone(0, 0, _zoneData); 
   } 
   catch (Exception ex) 
   { 
      MessageBox.Show (ex.Message); 
   } 
 
   rasterDocument.Shutdown(); 
}

Remarks

Retrieves zone information for the specified zone index in the specified page. To remove a specific zone, call RemoveZone. To add a zone, call AddZone.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

The Leadtools.Document namespace is deprecated and no longer supported as of LEADTOOLS v16. For v16 and later, please refer to: Leadtools.Forms.Ocr. This documentation is retained for v15 and earlier informational use only.