Unable to set annot Subject...

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

Unable to set annot Subject...

Post by lidds »

I am trying to override / change the Subject of an annotation element when imported. I am doing the following code, but for some reason it is not work??

Code: Select all

				If oper.ID = Me.docPreview.Inst.Str2ID("op.document.importCommentsAndFields", False) Then

                    Dim docModified As Boolean = Me.docPreview.Doc.Modified
                    Dim nID As Integer = Me.docPreview.Inst.Str2ID("op.annots.setProps", False)
                    Dim Op As PDFXEdit.IOperation = Me.docPreview.Inst.CreateOp(nID)
                    Dim inputProps As PDFXEdit.ICabNode = Op.Params.Root("Input")
                    Dim annotsList As PDFXEdit.IPXV_AnnotsList = Me.docPreview.Inst.CreateAnnotsList()

                    If importingAnnots = True Then
                        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 addToTable As Boolean = False
                                    Dim annot As PDFXEdit.IPXC_Annotation = page.GetAnnot(j)
                                    If annot.IsMarkup Then
                                        inputProps.Add().v = annot

                                        Dim options As PDFXEdit.ICabNode = Op.Params.Root("Options")
                                        options("Subject").v = "Highlight"
                                        options("Flags").v = 640
                                        options("Mask").v = 4194304
                                        Op.Do()
                                    End If
                                Next
                            End If
                        Next
                    End If
                End If
Thanks

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

Re: Unable to set annot Subject...

Post by Sasha - Tracker Dev Team »

Hello Simon,

Well you have not specified the PXV_OpModifyAnnotMaskFlags.OpModifyAnnot_Subject mask flag thus the subject itself is not being modified.
PS: as a piece of advice - use the flag names in your code not their direct values - there is a minor possibility that the number itself can be changed in one of the builds (not really but it can sometimes happen).

Code: Select all

options("Mask").v = (int)PDFXEdit.PXV_OpModifyAnnotMaskFlags.OpModifyAnnot_Subject
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply