Code: Select all
Public Sub LockAnnotations(ByVal lockAll As Boolean, ByVal userOID As Guid)
Dim pSInt As PDFXEdit.IPXS_Inst = DirectCast(Me.docPreview.Inst.GetExtension("PXS"), PDFXEdit.IPXS_Inst)
Dim nID As Integer = Me.docPreview.Inst.Str2ID("op.annots.setProps", False)
Dim Op As PDFXEdit.IOperation = Me.docPreview.Inst.CreateOp(nID)
Dim input As PDFXEdit.ICabNode = Op.Params.Root("Input")
Dim page As PDFXEdit.IPXC_Page = Me.docPreview.Doc.CoreDoc.Pages(0)
Dim nPageCount As UInteger = page.GetAnnotsCount()
For i As UInteger = 0 To nPageCount - 1
Dim annot As PDFXEdit.IPXC_Annotation = page.GetAnnot(i)
If annot.IsMarkup Then
Dim data As PDFXEdit.IPXC_AnnotData = annot.Data
Dim mData As PDFXEdit.IPXC_AnnotData_Markup = DirectCast(data, PDFXEdit.IPXC_AnnotData_Markup)
' mData.Title is the username of who placed the annotation
If lockAll = False Then
If mData.Title.ToString.ToUpper <> userOID.ToString.ToUpper Then
input.Add().v = annot
End If
ElseIf lockAll = True Then
If MISData.Instance.ViewerMode = "Sign" Then
' If docdesigner is in Sign mode then we do not want to lock any signature stamps which are stored under the
' department "Signatures"
If mData.Subject <> "Signatures" Then
input.Add().v = annot
End If
Else
input.Add().v = annot
End If
End If
End If
Next
If input.Count = 0 Then
Return
End If
Dim options As PDFXEdit.ICabNode = Op.Params.Root("Options")
options("Flags").v = 128
options("Mask").v = 4194304
Op.Do()
End Sub
Simon