Trainable Document Separation (TDS)
Document_BeforeSeparatePages( _
ByVal pXDoc As CscXDocument, _
ByRef bSkip As Boolean
)
You can disable document separation altogether by setting the pXDoc to TRUE.
If the separation process occurs before the first page in a document is classified, an addition event is possible:
Document_XDocPageRotated( _
ByVal RotationBy As CASCADELib.CscAutoRotation, _
ByVal pXDoc As CASCADELib.CscXDocument, _
ByVal PageNr As Long, _
ByVal Rotation As CASCADELib.CscXDocRotationTypeEnum, _
ByRef bCancel As Boolean
)
If the script cannot successfully classify a document, it is rotated by 90° clockwise and classification is re-executed. The page is rotated by 90° until the document is successfully classified or it returns to its original orientation. If the classification is successful for a rotation step, the rotation event is fired. If this is canceled from script by setting bCancel to TRUE, the remaining rotation directions are applied and classification is executed for the page. This is done for all rotation directions where the page is not classified or the rotation is canceled by script. The RotationBy parameter is set to CscAutoRotationByDocumentClassifier.
Then all unclassified pages are checked if content classification is required and recognition is required. This may raise another XDocPageRotated event with the RotationBy parameter set to CscAutoRotationByOCR. This reflects a rotation that is suggested by the recognition. If this event is canceled the recognition is executed again, without rotation.
If the Document_XDocRotated event is executed in Project Builder you cannot access the CscXFolder object. To ensure that any implementation does not terminate the application abnormally, evaluate the (Project.ScriptExecutionMode=CscScriptModeServerDesign) script execution mode.
With all this page classification information the following event is executed:
Document_BeforeTDS( _
ByVal pXDoc As CASCADELib.CscXDocument, _
ByRef bSkip As Boolean
)
Each pXDoc document that is processed by TDS is passed to this event with the PageClassificationConfidence parameter on the page level that is used by TDS. You can modify this information before TDS is executed by setting the SplitPage flag for the pages in a document where the split occurs.
Document_AfterSeparatePages( _
ByVal pXDoc As CscXDocument
)
This is the final event of the trainable document separation for the given document pXDoc. Here the complete document is defined before document separation is applied. At this time, you can modify the pXDoc.CDoc.Pages(...).SplitPage parameter to flag the pages before the document is split.
The sequence of the trainable document separation events is shown in the following example:
