Use locator results for Standard Document Separation
You can use a locator (for example a barcode locator) to establish document boundaries in preparation for document classification later down the line. The recommended solution is to add locator(s) to a "dummy" class (called for example "DocSep") that is used exclusively for document separation and excluded from the classification phase. You can run the locators on this class before separation occurs and use the results to explicitly set the boundaries.
Use the Document_BeforeSeparatePages script hook which fires before any page classification or separation occurs.
' Project Script
Private Sub Document_BeforeSeparatePages(ByVal pXDoc As CASCADELib.CscXDocument, ByRef bSkip As Boolean)
Dim oTmpXDoc As CscXDocument
'Declaration required if separation locator requires OCR
'You must also add the Kofax Memphis Forms 4.0 reference from Edit | References...
'Dim PageRecognizer As New MpsPageRecognizing
Dim lPage As Long
For lPage = 0 To pXDoc.CDoc.Pages.Count-1
'For locators requiring OCR: You must call OCR directly with the following line
'PageRecognizer.Recognize pXDoc, Project.RecogProfiles.ItemByName("FineReader"), lPage
'Create a temporary document containing only this page
'and run locators from 'DocSep' class on that document.
Set oTmpXDoc = New CscXDocument
oTmpXDoc.CopyPages pXDoc, lPage, 1
Project.ClassByName("DocSep").Extract oTmpXDoc
'Get the locator results
Dim oLocator As CscXDocField
Set oLocator = oTmpXDoc.Locators.ItemByName("BL_Barcode")
Dim lAlt As Long
For lAlt = 0 To oLocator.Alternatives.Count-1
'Check a confident alternative is found on the current page
If oLocator.Alternatives(lAlt).Confidence > 0 Then
'Directly set the separation boundary
pXDoc.CDoc.Pages.ItemByIndex(lPage).SplitPage = True
End If
Next
Next
End Sub