Adds a new zone to the zone list of the specified page.
Syntax
Parameters
- pageIndex
- Index of the page on which to add the zone. This is a zero-based index.
- zoneIndex
- Position in the list of zones at which to add the new zone. Use -1 to append the page to the end of the list. This is a zero-based index.
- zoneData
- RasterDocumentZoneData class that contains the zone data to be added.
Example
Visual Basic | Copy Code |
---|
Public Sub AddZoneExample()
Dim buffer As String
RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey")
Dim rasterDocument As RasterDocumentEngine
rasterDocument = RasterDocumentEngine.Instance
rasterDocument.Startup()
Dim zoneData As RasterDocumentZoneData = New RasterDocumentZoneData()
zoneData.Rectangle = New Rectangle(100, 100, 100, 100)
zoneData.FillMethod = RasterDocumentFillMethod.Default
zoneData.RecognizeModule = RasterDocumentRecognizeModule.Auto
zoneData.CharacterFilter = RasterDocumentCharacterFilter.Default
zoneData.Type = RasterDocumentZoneType.FlowText
zoneData.Flags = RasterDocumentZoneFlags.None
zoneData.SectionName = "cities"
Try
rasterDocument.AddZone(0, 0, zoneData)
buffer = String.Format("The engine added a new zone to the document successfully" & Constants.vbLf & "The Added Zone ID = {0}", zoneData.Id)
MessageBox.Show(buffer)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Dim zoneCount As Integer = rasterDocument.GetZoneCount(0)
buffer = String.Format("Total zones in the specified page: {0}" & zoneCount)
MessageBox.Show(buffer)
rasterDocument.Shutdown()
End Sub |
C# | Copy Code |
---|
public void AddZoneExample() { string buffer; // 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 RasterDocumentZoneData zoneData = new RasterDocumentZoneData(); zoneData.Rectangle = new Rectangle(100, 100, 100, 100); zoneData.FillMethod = RasterDocumentFillMethod.Default; zoneData.RecognizeModule = RasterDocumentRecognizeModule.Auto; zoneData.CharacterFilter = RasterDocumentCharacterFilter.Default; zoneData.Type = RasterDocumentZoneType.FlowText; zoneData.Flags = RasterDocumentZoneFlags.None; zoneData.SectionName = "cities"; try { rasterDocument.AddZone(0, 0, zoneData); buffer = string.Format("The engine added a new zone to the document successfully\nThe Added Zone ID = {0}", zoneData.Id); MessageBox.Show(buffer); } catch (Exception ex) { MessageBox.Show(ex.Message); } int zoneCount = rasterDocument.GetZoneCount(0); buffer = string.Format("Total zones in the specified page: {0}" + zoneCount); MessageBox.Show(buffer); rasterDocument.Shutdown(); } |
Remarks
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