Code: Select all
' Change all annotation elements to selected status
Dim JS As New StringBuilder
JS.AppendLine("//JS Code to search for an annotation and get status of it where StateInModel is Review")
JS.AppendLine("//the JS output is passed to the SDK IString Res")
JS.AppendLine("this.syncAnnotScan();")
JS.AppendLine("var annots = this.getAnnots({")
JS.AppendLine("nSortBy: ANSB_Author,")
JS.AppendLine("bReverse: true")
JS.AppendLine("});")
JS.AppendLine("")
JS.AppendLine("var stateResults;")
JS.AppendLine("var returnResults;")
JS.AppendLine("returnResults = """";")
JS.AppendLine("var selAnnots = [")
' Loop through annotations
Dim annotsList As PDFXEdit.IPXV_AnnotsList = Me.docPreview.Inst.CreateAnnotsList()
For i As UInteger = 0 To Me.docPreview.Doc.CoreDoc.Pages.Count - 1
Dim page As PDFXEdit.IPXC_Page = Me.docPreview.Doc.CoreDoc.Pages(i)
Dim nCnt As UInteger = page.GetAnnotsCount()
If nCnt <> 0 Then
For j As UInteger = 0 To nCnt - 1
Dim annot As PDFXEdit.IPXC_Annotation = page.GetAnnot(j)
inputDelete.Add().v = annot
JS.AppendLine("""" & annot.Name & """" & ",")
Next
End If
Next
JS.AppendLine("];")
JS.AppendLine("identity.name = """ & MISData.Instance.FirstName & """;")
JS.AppendLine("for (var i = 0; i < annots.length; i++) {")
JS.AppendLine("for (var j = 0; j < selAnnots.length; j++) {")
JS.AppendLine("if (selAnnots[j] == annots[i].name) {")
JS.AppendLine("annots[i].transitionToState(""Review"",""None"");")
JS.AppendLine("}")
JS.AppendLine("}")
JS.AppendLine("}")
Me.docPreview.Inst.ExecuteJS(Me.docPreview.Doc, JS.ToString, PDFXEdit.PXV_ActionTriggerClass.PAEC_External, PDFXEdit.PXV_ActionTriggerSubclass.PAESC_Exec, Nothing, res)
Simon