Skip to main content
Kofax

Scripting - Redaction - How to use Redaction

Article # 3035822 - Page views: 227

Issue

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

 

Solution

Note-Icon.png

NOTE: Redaction is only supported for single page 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:

In this example when button named Button0 is clicked, alternatives from locator named Amounts are used to redact the image

' 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

 

Level of Complexity 

Moderate

 

Applies to  

Product Version Build Environment Hardware
Kofax Transformation Modules All      

 

 

Article # 3035822
  • Was this article helpful?