Skip to main content

How to delete pages in KTM Server automatically?


QAID # 18530  NOT Published 

QAID # 18530  NOT Published

Please do NOT provide the article number (QAID) and/or URL of this Knowledgebase article or its contents to external customers, as it is NOT Published and/or * INTERNAL ONLY *.

Question / Problem:

How to delete pages in KTM Server automatically?

Answer / Solution:

You can delete or move pages in the events Batch_open and Batch_close only.

The following example deletes every 2nd page, if the document has more than 1 page:

Private Sub Batch_Close(ByVal pXRootFolder As CASCADELib.CscXFolder, ByVal CloseMode As CASCADELib.CscBatchCloseMode)
If Project.ScriptExecutionMode =CscScriptModeServer Then
Dim i As Integer
For i=0 To pXRootFolder.DocInfos.Count-1
If pXRootFolder.DocInfos(i).PageCount>1 Then Batch.DeletePage(pXRootFolder.DocInfos(i),1) End If
End If
End Sub

Applies To: 

Product Version Category
AXPRO 4.0 Script
AXPRO 4.5 Script
AXPRO 5.0 Script
AXPRO 5.5 Script
AXPRO 6.0 Script