Skip to main content

Document Separation

Article # 304858 - Page views: 1132


QAID # 17348 Published

Question / Problem:

Document Separation

Answer / Solution:

  1. Open Project Settings and set document separation mode to "Standard Document Separation."
  2. Add a class to your project and name it "DocSep." This will be used to define the document separation locator, document separation method or documemt separation zone.
  3. Add a locator method that you want to use in order to determine the document separation flag, e.g., Barcode locator.
  4. Select the Project class and open the script editor.
  5. Edit the Document_SeparateCurrentPage event and add the following code:
    Private Sub Document_SeparateCurrentPage(pXDoc As CASCADELib.CscXDocument, _
            ByVal PageNr As Long, bSplitPage As Boolean, RemainingPages As Long)
        Dim oSinglePageDoc As CscXDocument
        Set oSinglePageDoc = New CscXDocument
        'Create a temporary document with a single page
        oSinglePageDoc.CopyPages(pXDoc, PageNr, 1)
        'Read the bar code
        Project.ClassByName("DocSep").Extract oSinglePageDoc
        'If the bar code is a separation barcode then split the document
        bSplitPage = BarcodeSeparation(oSinglePageDoc.Fields.ItemByName("Barcode").Text)
    End Sub
  6. Add your own code to evaluate the separator locator method. Example BarcodeSeparation. If the bSplit parameter returns true, then the document will be separated.
    Private Function BarcodeSeparation(ByVal sValue As String) As Boolean
        ' Return true if the barcode is a seperation barcode
        If LCase(Left(sValue, 2)) = "rb" Then
            BarcodeSeparation = True
            BarcodeSeparation = False
        End If
    End Function

In order to perform document separation in Project Builder, you will need to process multipage TIFFs, or merge your single page XDocs into a multipage XDoc by selecting all the XDocs, right-clicking, and choosing "merge".

Download an example project and one example multipage TIFF:

  • Was this article helpful?