PDF-XChange - Tracker PDF Viewer - TIFF-XChange - Image-XChange - XMF-XChange - Raster-XChange - Support

Moderators: Tracker Support, Paul - Tracker Supp, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Ivan - Tracker Software, Sean - Tracker, 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.
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Annotation flags to allow reply and status, but no other modification

Wed Nov 29, 2017 5:06 pm

I have neem trying to set the op.annots.setProps flags to bascially acheive the folloiw:

1. Stop ueer from moving, deleting, resize or change annotation colour, tex size etc.
2. Allow the user to add a reply or change the status of the annotation.

I have tried different variations, but all ssem to allow replies to comments but NOT allow the status to be changed.

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

Re: Annotation flags to allow reply and status, but no other modification

Wed Nov 29, 2017 5:25 pm

Hello Simon,

What combinations have you tried?
Have you tried AF_Locked + AF_ContentLocked and do these two work for you? Can a reply be placed for such an annotation?

Regards,
Stefan
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Thu Nov 30, 2017 2:55 pm

Stefan,

This does not work either, I am using the following code. To replicate the issue, just place some annotation on a pdf and run the following code. You will notice you can add a reply, but not change the status of the annotation.

      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)
            input.Add().v = annot
          Next

        If input.Count = 0 Then
            Return
        End If

        Dim options As PDFXEdit.ICabNode = Op.Params.Root("Options")
        options("Flags").v = 640
        options("Mask").v = 4194304
        Op.Do()


Thanks

Simon
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Sun Dec 03, 2017 12:58 pm

Stefan,

Any idea on this?

Thanks

Simon
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Tue Dec 05, 2017 12:27 pm

Stefan,

I have just noticed that I posted this in the Viewer SDK, where I am actually using the Editor SDK. Could you please move it for me.

Also do you have a solution to this at all?

Thanks

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

Re: Annotation flags to allow reply and status, but no other modification

Tue Dec 05, 2017 2:34 pm

Hello Simon,

I've moved the topic and am asking a colleague from the dev team for help with this one!

Regards,
Stefan
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2667
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotation flags to allow reply and status, but no other modification

Tue Dec 05, 2017 3:16 pm

Hello Simon,

Please create a combination that you need in the End-User Editor. If it's possible - then we can advice further. If not - I'm afraid that's not possible with this approach. One of the ways would be to catch before operation execute events and see how the annotations are being modified - if it's what you don't want to be - then cancel the operation. Though saving and sharing this document won't do anything outside your program.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Wed Dec 06, 2017 11:17 am

Alex,

It looks like if the annotation is set to ReadOnly or Locked then the change status is disabled. Just one thought, is it possible to enable the button on the context menu if I modify the context menu before showing?

I have tried the following, but am getting an error as it can't find the cmd.annot.status on the menu, I guess I am doing something wrong

        Public Sub OnEvent(pSender As PDFXEdit.IUIX_Obj, pEvent As PDFXEdit.IUIX_Event) Implements PDFXEdit.IUIX_ObjImpl.OnEvent
            'Console.WriteLine("Event Code: " & pEvent.Code.ToString)
            If pEvent.Code = CInt(&H204) Then
                'Console.WriteLine("Event Code: " & pEvent.Code)
                Dim pt As PDFXEdit.tagPOINT
                pt.x = pEvent.Pos.x
                pt.y = pEvent.Pos.y
                Dim screenPt As PDFXEdit.tagPOINT
                Dim nHitTestCode As Integer = 0
                Dim annot As PDFXEdit.IPXC_Annotation = Parent.docPreview.Doc.ActiveView.PagesView.GetAnnotFromPt(pt, nHitTestCode)

                If annot IsNot Nothing Then
                    Dim cmd As PDFXEdit.IUIX_Cmd = Nothing
                    Dim nMenuIndex As Long
                    Dim cmdDoc As IUIX_CmdItem
                    Dim nFlatIndex As Long

                    ' Enables set status context menu item
                    Dim cmdBar As IUIX_CmdBar
                    cmdBar = Parent.docPreview.Inst.ActiveMainFrm.View.MenuBar
                    nFlatIndex = cmdBar.FlatFindFirstItemByCmdName("cmd.annot.status")
                    cmdDoc = cmdBar.FlatGetItem(nFlatIndex)
                    cmdDoc.Cmd.Offline = False


Thanks

Simon
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2667
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotation flags to allow reply and status, but no other modification

Wed Dec 06, 2017 12:39 pm

Hello Simon,

Better try creating a custom command handler for the status command, use the old handler's methods inside everywhere except GetState method. That should work.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Wed Dec 06, 2017 2:04 pm

Alex,

To be honest I am well out my depth on what you replied, I have been searching the forum, and have put the following code together. I think I am probably completely wrong on what I am doing and was wondering if you maybe able to assist. Sorry to ask, I do always try to get some code at least halfway there.

        Public Sub OnEvent(pSender As PDFXEdit.IUIX_Obj, pEvent As PDFXEdit.IUIX_Event) Implements PDFXEdit.IUIX_ObjImpl.OnEvent
            'Console.WriteLine("Event Code: " & pEvent.Code.ToString)
            If pEvent.Code = CInt(&H204) Then
                'Console.WriteLine("Event Code: " & pEvent.Code)
                Dim pt As PDFXEdit.tagPOINT
                pt.x = pEvent.Pos.x
                pt.y = pEvent.Pos.y
                Dim screenPt As PDFXEdit.tagPOINT
                Dim nHitTestCode As Integer = 0
                Dim annot As PDFXEdit.IPXC_Annotation = Parent.docPreview.Doc.ActiveView.PagesView.GetAnnotFromPt(pt, nHitTestCode)

                If annot IsNot Nothing Then
                    Dim cmd As PDFXEdit.IUIX_Cmd = Nothing
                    Dim nMenuIndex As Long
                    Dim cmdDoc As IUIX_CmdItem
                    Dim nFlatIndex As Long

                    Dim cmdBar As IUIX_CmdBar
                    nFlatIndex = cmdBar.FlatFindFirstItemByCmdName("cmd.annot.status")
                    cmdDoc = cmdBar.FlatGetItem(nFlatIndex)
                    cmdBar = Parent.docPreview.Inst.ActiveMainFrm.View.MenuBar
                    Dim item As IUIX_CmdItem = Nothing
                    cmd.Handler.OnGetItemState(cmdBar, item, Parent.docPreview.Inst.ActiveMainView.Obj, 0)


Thanks

Simon
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2667
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotation flags to allow reply and status, but no other modification

Wed Dec 06, 2017 2:54 pm

Hello Simon,

Here's the code sample that I was talking about:
https://gist.github.com/Polaringu/16bb2 ... 7cbe36f4e6

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Thu Dec 07, 2017 9:54 am

Alex,

Thanks for the link. I have been trying to get this to work, however I am getting the following error:

Additional information: Unable to cast object of type 'StateCommandHandler' to type 'PDFXEdit.IUIX_CmdHandler'.

On this line of code:

cmd.Handler = cmdHandler

Which I am calling from the OnEvent:

        Public Sub OnEvent(pSender As PDFXEdit.IUIX_Obj, pEvent As PDFXEdit.IUIX_Event) Implements PDFXEdit.IUIX_ObjImpl.OnEvent
            If pEvent.Code = CInt(&H204) Then
                Dim pt As PDFXEdit.tagPOINT
                pt.x = pEvent.Pos.x
                pt.y = pEvent.Pos.y
                Dim screenPt As PDFXEdit.tagPOINT
                Dim nHitTestCode As Integer = 0
                Dim annot As PDFXEdit.IPXC_Annotation = Parent.docPreview.Doc.ActiveView.PagesView.GetAnnotFromPt(pt, nHitTestCode)

                If annot IsNot Nothing Then
                    Dim cmdHandler As PDFEditorCommandHandler.StateCommandHandler = Nothing
                    cmdHandler = New PDFEditorCommandHandler.StateCommandHandler(Parent.docPreview.Inst)
                    Dim iuiInst As PDFXEdit.IUIX_Inst = CType(Parent.docPreview.Inst.GetExtension("UIX"), PDFXEdit.IUIX_Inst)

                    Dim cmd As PDFXEdit.IUIX_Cmd = iuiInst.CmdManager.Cmds.Find("cmd.annot.status")
                    cmdHandler.m_OldStateAsHandler = cmd.Handler
                    cmd.Handler = cmdHandler
                End If
        End Sub                                 


Below is my PDFEditorCommandHandler class code:

Public Class PDFEditorCommandHandler
    Class StateCommandHandler
        Public m_Inst As PDFXEdit.IPXV_Inst = Nothing
        Private m_nStateID As Long = 0
        Public m_OldStateAsHandler As PDFXEdit.IUIX_CmdHandler = Nothing

        Public Sub New(ByVal Inst As PDFXEdit.IPXV_Inst)
            MyBase.New()
            Me.m_Inst = Inst
            Me.m_nStateID = Me.m_Inst.Str2ID("cmd.annot.status")
        End Sub

        Public Sub OnCreateNewCtl(ByVal pCmd As PDFXEdit.IUIX_Cmd, ByVal pParent As PDFXEdit.IUIX_CmdBar, ByRef pCtl As PDFXEdit.IUIX_Obj)
            If (pCmd.ID = Me.m_nStateID) Then
                Me.m_OldStateAsHandler.OnCreateNewCtl(pCmd, pParent, pCtl)
            Else
                pCtl = Nothing
            End If
        End Sub

        Public Sub OnGetItemState(ByVal pCmd As PDFXEdit.IUIX_Cmd, ByVal pItem As PDFXEdit.IUIX_CmdItem, ByVal pOwner As PDFXEdit.IUIX_Obj, ByRef nState As Integer)
            If (pCmd.ID = Me.m_nStateID) Then
                Me.m_OldStateAsHandler.OnGetItemState(pCmd, pItem, pOwner, nState)
            Else
                nState = CType(PDFXEdit.UIX_CmdItemState.UIX_CmdItemState_Unknown, Integer)
            End If
        End Sub

        Public Sub OnGetCtlSizes(ByVal pItem As PDFXEdit.IUIX_CmdItem, ByRef nSize As PDFXEdit.tagSIZE, ByRef nMinSize As PDFXEdit.tagSIZE, ByRef nMaxSize As PDFXEdit.tagSIZE)
            If (pItem.Cmd.ID = Me.m_nStateID) Then
                Me.m_OldStateAsHandler.OnGetCtlSizes(pItem, nSize, nMinSize, nMaxSize)
            End If
        End Sub

        Public Sub OnGetItemSubMenu(ByVal pItem As PDFXEdit.IUIX_CmdItem, ByRef pSubMenu As PDFXEdit.IUIX_CmdMenu)
            If (pItem.Cmd.ID = Me.m_nStateID) Then
                Me.m_OldStateAsHandler.OnGetItemSubMenu(pItem, pSubMenu)
            Else
                pSubMenu = pItem.SubMenu
            End If

        End Sub

        Public Sub OnNotify(ByVal nCode As Integer, ByVal pCmd As PDFXEdit.IUIX_Cmd, ByVal pItem As PDFXEdit.IUIX_CmdItem, ByVal pOwner As PDFXEdit.IUIX_Obj, ByVal nNotifyData As UInteger)
            If (pCmd.ID = Me.m_nStateID) Then
                Me.m_OldStateAsHandler.OnNotify(nCode, pCmd, pItem, pOwner, nNotifyData)
            End If
        End Sub

        Public Sub OnDrawItemIcon(ByVal pRC As PDFXEdit.IUIX_RenderContext, ByVal pItem As PDFXEdit.IUIX_CmdItem, ByRef stIconRect As PDFXEdit.tagRECT, ByRef stClip As PDFXEdit.tagRECT)
            If (pItem.Cmd.ID = Me.m_nStateID) Then
                Me.m_OldStateAsHandler.OnDrawItemIcon(pRC, pItem, stIconRect, stClip)
            End If
        End Sub
    End Class
End Class


Any ideas what I am doing wrong?

Thanks for your help.

Simon
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2667
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotation flags to allow reply and status, but no other modification

Thu Dec 07, 2017 1:48 pm

Hello Simon,

1) Always use the normal state in the OnGetItemState method if you want it to be always enabled.
2) About this:
 Public Sub OnEvent(pSender As PDFXEdit.IUIX_Obj, pEvent As PDFXEdit.IUIX_Event) Implements PDFXEdit.IUIX_ObjImpl.OnEvent
            If pEvent.Code = CInt(&H204) Then

You should do it after the control initialization once, not each time in some event (which I doubt that you need). Create a Form class variable and use it.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Thu Dec 07, 2017 4:25 pm

Alex,

Thanks for your response, however I am still getting the following error:

Error [System]: No such interface supported.

Now running the code on the Form_Shown event, as shown below:

    Private Sub frmDocDesigner_Shown(sender As Object, e As EventArgs) Handles Me.Shown
        Try
            Dim cmdHandler As PDFEditorCommandHandler.StateCommandHandler = Nothing
            cmdHandler = New PDFEditorCommandHandler.StateCommandHandler(Me.docPreview.Inst)
            Dim iuiInst As PDFXEdit.IUIX_Inst = CType(Me.docPreview.Inst.GetExtension("UIX"), PDFXEdit.IUIX_Inst)
            Dim cmd As PDFXEdit.IUIX_Cmd = iuiInst.CmdManager.Cmds.Find("cmd.annot.status")
            cmdHandler.m_OldStateAsHandler = cmd.Handler
            cmd.Handler = cmdHandler
        Catch ex As Exception
            Console.WriteLine(convertErr(ex))
        End Try
    End Sub


Thanks

Simon
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2667
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotation flags to allow reply and status, but no other modification

Sat Dec 09, 2017 6:33 am

Hello Simon,

What is the StateCommandHandler? The class of your custom handler should be derived from the IUIX_CmdHandler.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Sat Dec 09, 2017 6:44 am

Alex,

If you look at the above thread from Thu Dec 07, 2017 9:54 am the StateCommandHandler is derived from the IUIX_CmdHandler, that's why I am slightly confused as I adopted your code from your github link https://gist.github.com/Polaringu/16bb2 ... 7cbe36f4e6
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2667
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotation flags to allow reply and status, but no other modification

Sat Dec 09, 2017 6:48 am

Simon,

Where exactly are you getting this error?

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Sat Dec 09, 2017 7:03 am

Alex,

It errors on this line:

cmd.Handler = cmdHandler


With the following error:

Error [System]: No such interface supported.

Thanks

Simon
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2667
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotation flags to allow reply and status, but no other modification

Sat Dec 09, 2017 7:08 am

Hello Simon,

Do the next experiment - take the command handler of some command and set it as the command handler to another one. This will show whether there is a problem in your class or in VB.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Mon Dec 11, 2017 12:11 pm

Alex,

I hope I understood you correctly, I have done the following, but I still get this error "Error [System]: No such interface supported."

    Private Sub frmDocDesigner_Load(sender As Object, e As EventArgs) Handles Me.Load
        Try
            Dim cmdHandler As PDFEditorCommandHandler.StateCommandHandler = Nothing
            cmdHandler = New PDFEditorCommandHandler.StateCommandHandler(Me.docPreview.Inst)
            Dim iuiInst As PDFXEdit.IUIX_Inst = CType(Me.docPreview.Inst.GetExtension("UIX"), PDFXEdit.IUIX_Inst)
            Dim cmdRect As PDFXEdit.IUIX_Cmd = iuiInst.CmdManager.Cmds.Find("cmd.tool.annot.square")
            Dim cmdLine As PDFXEdit.IUIX_Cmd = iuiInst.CmdManager.Cmds.Find("cmd.tool.annot.line")

            cmdRect.Handler = cmdLine
        Catch ex As Exception
            Console.WriteLine(convertErr(ex))
        End Try
    End Sub


Thanks

Simon
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2667
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotation flags to allow reply and status, but no other modification

Mon Dec 11, 2017 12:27 pm

Hello Simon,

That's not what I meant:
IUIX_Inst iuiInst = (PDFXEdit.IUIX_Inst)pdfCtl.Inst.GetExtension("UIX");
IUIX_Cmd cmd = iuiInst.CmdManager.Cmds.Find("cmd.save");
IUIX_CmdHandler hndl = cmd.Handler;
IUIX_Cmd cmd1 = iuiInst.CmdManager.Cmds.Find("cmd.saveAs");
cmd1.Handler = hndl;

See whether this gives any errors.
Also, please specify what method exactly gives the error.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
lidds
User
Topic Author
Posts: 219
Joined: Sat May 16, 2009 1:55 pm

Re: Annotation flags to allow reply and status, but no other modification

Mon Dec 11, 2017 12:46 pm

Alex,

The code you sent does not error.

However if I run the following code, it errors on line "cmd.Handler = cmdHandler"

Dim cmdHandler As PDFEditorCommandHandler.StateCommandHandler = Nothing
            cmdHandler = New PDFEditorCommandHandler.StateCommandHandler(Me.docPreview.Inst)
            Dim iuiInst As PDFXEdit.IUIX_Inst = CType(Me.docPreview.Inst.GetExtension("UIX"), PDFXEdit.IUIX_Inst)
            Dim cmd As PDFXEdit.IUIX_Cmd = iuiInst.CmdManager.Cmds.Find("cmd.annot.status")
            Dim hndl As IUIX_CmdHandler = cmd.Handler
            cmdHandler.m_OldStateAsHandler = hndl
            cmd.Handler = cmdHandler


Unsure as to why this is happening

Thanks

Simon
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 2667
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Annotation flags to allow reply and status, but no other modification

Mon Dec 11, 2017 2:52 pm

Hello Simon,

Well then the problem is in your code. I gave you a sample that works - I'm afraid we can't advice further, because this exceeds the support limits.
What you can do is implement the derivation correctly from the IUIX_CmdHandler interface and that should work.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Who is online

Users browsing this forum: No registered users and 3 guests