Skip to main content
Kofax

How to Save the Snippet of a Format Locator as a TIFF File

17335

 QAID # 17335 Published

Question / Problem:

How to Save the Snippet of a Format Locator as a TIFF File

Answer / Solution:

This example shows how to save a TIFF file which contains the snippet of the first alternative of an Format Locator.

A Format Locator searches for an value on a Document. A Script Locator checks whether there is at least one value (alternative) found. If so, it creates an image in C:\Temp\.

Script code used:

' extraction script for class Base

'******************************************************************************************
'* This example shows you how a snipped of an format locator alternative can be stored
'* Created by: Timo Lievert - Kofax Development
'* Date: 20.05.2008

'* KTM Version: 3.5
'******************************************************************************************

Private Sub SL_LocateAlternatives(ByRef pXDoc As CASCADELib.CscXDocument, _
                                  ByRef pLocator As CASCADELib.CscXDocField)

   Dim image As CscImage
   Dim field As CscXDocFieldAlternative
   Dim image2 As New CscImage
   Dim matchPage As Long

   If pXDoc.Locators.ItemByName("FL").Alternatives.Count > 0 Then
      Set field = pXDoc.Locators.ItemByName("FL").Alternatives.ItemByIndex(0)
      matchPage = pXDoc.Locators.ItemByName("FL").Alternatives.ItemByIndex(0).PageIndex
      Set image = pXDoc.CDoc.Pages(matchPage).GetImage

      image2.CreateImage(CscImgColFormatBinary, field.Width, field.Height, _
                         image.XResolution, image.YResolution)

      image2.CopyRect(image, field.Left, field.Top, 0, 0, field.Width, field.Height)

      image2.Save("C:\Temp\Snipped1.tif", CscImgFileFormatTIFFFaxG4)
   End If

End Sub 

Please note that this example can be modified easily to use any other locator method.

Click here to download the example project.

Applies to:

Product

Version

Category

AXPRO

4.0

Configuration

AXPRO

4.5

Configuration

AXPRO

5.0

Configuration

AXPRO

5.5

Configuration

  • Was this article helpful?