Skip to main content

How can I use Redaction in Kofax Transformation Modules (KTM)?


QAID # 13402 Published 

Question / Problem:

How can I use Redaction in Kofax Transformation Modules (KTM)?

Answer / Solution:

Important Note: Redaction is only supported for singleipage TIFFs. It works on multipage Documents of course, but only if each page of the Document is a single TIFF file. In a Kofax Capture environment, this is always the case so there should be no problem. In the Project Builder, make sure that you test this on single page TIFFs.

This code sample/example shows how to redact (make black) all alternatives of a certain locator:

' extraction script for class NewClass1
Private Sub ValidationForm_ButtonClicked(ByVal ButtonName As String,
                                         ByVal pXDoc As CASCADELib.CscXDocument)
    Select Case ButtonName
        Case "Button0"
            Dim i As Long
            Dim oImage As CscImage
            Dim oLocator As CscXDocField
            Dim oAlt As CscXDocFieldAlternative
            ' Get the locator
            Set oLocator = pXDoc.Locators.ItemByName("Amounts")
            ' Check if it has alternatives
            If oLocator.Alternatives.Count = 0 Then Exit Sub
            ' For all alternatives
            For i = 0 To oLocator.Alternatives.Count - 1
                Set oAlt = oLocator.Alternatives(i)
                ' Get image of the page where current alternative is located
                Set oImage = pXDoc.CDoc.Pages(oAlt.PageIndex).GetImage()
                ' Redact the image (Version 3.1+)
                oImage.Redact(oAlt.Left, oAlt.Top, oAlt.Width, oAlt.Height)
                ' Older versions:
                ' Use oImage.CopyRect(...), see script documentation
                ' Note: You need a black tiff to copy a rectangle from.
                ' Save the image
                oImage.Save(oImage.FileName, CscImgFileFormatTIFFFaxG4)
            Next i
    End Select
End Sub

Applies to:

Product Version Category
AXPRO 3.1 Configuration
AXPRO 3.1 Project Builder
AXPRO 3.5 Configuration
AXPRO 3.5 Project Builder
AXPRO 4.0 Configuration
AXPRO 4.0 Project Builder
AXPRO 4.5 Configuration
AXPRO 4.5 Project Builder