Annoation elements not visible in print menu...

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Annoation elements not visible in print menu...

Post by lidds »

I am running the below code to stop users modify annotation that is not placed by then. The problem is that once I change the annotation to be "Locked" it is no longer able to be printed.

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
Thanks

Simon
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Annoation elements not visible in print menu...

Post by Tracker Supp-Stefan »

Hello Simon,

The description for the AF_ReadOnly flag is:
If set, the annotation will not interact with the user. The annotation may be displayed or printed (depending on the settings of the AF_NoView and AF_Print flags) but will not respond to mouse clicks or change its appearance in response to mouse motions. This flag ignored for widget annotations; its function is subsumed by the FF_ReadOnly flag of the associated form field.

So you need to also set the AF_Print one. Please try to have both flags on and see if it works?

Regards,
Stefan
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Annoation elements not visible in print menu...

Post by lidds »

Thanks Stefan,

However I am unsure how to set multiple flags. If I duplicate the following lines of code but use the print flag it overrides the read-only flag.

Code: Select all

options("Flags").v = 128
        options("Mask").v = 4194304
        Op.Do
        
options("Flags").v = 4
        options("Mask").v = 4194304
        Op.Do()
Thanks

Sinn
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Annoation elements not visible in print menu...

Post by Tracker Supp-Stefan »

Hi Sinn,

Add them together
4 + 128 = 132 - try setting the flags parameter as 132 (and only once).

Cheers,
Stefan
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annoation elements not visible in print menu...

Post by Sasha - Tracker Dev Team »

Hello Simon,
However I am unsure how to set multiple flags.
As Stefan said - a normal bitwise operations.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply