Classification Using Bar Codes
Article # 3037094 - Page views: 174
Issue
Document Separation
Solution
- Open Project Settings and set document separation mode to "Standard Document Separation."
- 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.
- Add a locator method that you want to use in order to determine the document separation flag, e.g., Barcode locator.
- Select the Project class and open the script editor.
- 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
- Add your own code to evaluate the separator locator method. Example BarcodeSeparation. If the
bSplit
parameter returnstrue
, then the document will be separated.
Example: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 Else 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: Barcode_Separation_Project.zip.
Level of Complexity
High
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
KTM | 6.3, 6.4 | All | All | None |