Is there a way to remove annot state

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

Is there a way to remove annot state

Post by lidds »

I am using the following code to set annotation state to None, however I would actually like to complete remove any existing annotation state. Is this possible?

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)
Thanks

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

Re: Is there a way to remove annot state

Post by Sasha - Tracker Dev Team »

Hello Simon,

From what I see, there is no sample like that in the Arobat JS Reference, so I think that is not possible. Though, maybe you will be able find something looking in different sources.

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