Skip to main content
Kofax

Get Document Page Count in .NET Validation Script

14069

Question / Problem:

Is it possible to get the Page count (number of Pages) for a Document while in Validation?

Answer / Solution:

The Kofax Capture Values do not include a value for the number of Pages in a Document. It is possible to obtain this value from a .NET-based Index (Validation) Script using the PageCount property of the Document object.

The following example shows the Field Post Processing event for an Index Field named “Pagecount”. In this example, the value for the PageCount property of the Document object is used to set this value to the corresponding Index Field:

Private Sub Pagecount_FieldPostProcessing(ByVal sender As Object, ByVal e As
Kofax.AscentCapture.Scripting.PostFieldEventArgs)
Handles PageCount.FieldPostProcessing
    PageCount.IndexField.Value = PageCount.IndexField.Document.PageCount
End Sub

The following example shows the Document Pre Processing event for a Document Class named “TestDocument”. In this example, the value for the PageCount property of the Document object is used to display the number of Pages in a Message Box:

Private Sub TestDocument_DocumentPreProcessing(ByVal sender As Object, ByVal e As
Kofax.AscentCapture.Scripting.PreDocumentEventArgs)
Handles Me.DocumentPreProcessing
    MsgBox("***** " + e.Document.PageCount.ToString)
End Sub

 

Applies to:

Product Version
CAPTURE 10.0
  10.1
  10.2
  11.0