Access preprocessed zone images of a Advanced Zone Locator
By default these zone images are not available from script to optimize memory consumption during document processing. If
you activate the property
SaveXDocImages
of the
Advanced Zone Locator in the
BeforeExtract
event you can access the registered coordinates, the original coordinates, and the preprocessed image
for each defined zone. This information is only accessible after extraction and is not saved to disk, you can access this
information as shown in the
AfterExtract
event. You have to add an additional reference, by selecting
References from the
Edit menu, for the
Advanced Zone Locator (Kofax Cascade
Advanced Zone Locator 4.0) to the script sheet where you insert the following script code.
' Class Script
Private Sub Document_BeforeExtract(pXDoc As CASCADELib.CscXDocument)
Dim oClass As CscClass
Dim oLocDef As CscLocatorDef
Dim oAdvZoneLoc As CscAdvZoneLocator
Set oClass = Project.ClassByName("MyClassName")
Set oLocDef = oClass.Locators.ItemByName("MyAdvancedZoneLocator")
Set oAdvZoneLoc = oLocDef.LocatorMethod
oAdvZoneLoc.SaveXDocImages = True
End Sub
Private Sub Document_AfterExtract(pXDoc As CASCADELib.CscXDocument)
Dim oRep As CscXDocRepresentation
Dim oXDocImg As CscXDocImage
Dim oImg As CscImage
Set oRep = pXDoc.Representations.ItemByName("AdvZoneLoc") ' this is the image of the 0. defined (first) zone in the advanced zone locator
Set oXDocImg = oRep.Images(0)
Set oImg = oXDocImg.Image
oImg.Save("C:\xyz.tif")
End Sub