Determining Which Bookmark Selected In Bookmark Pane

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
plgoldman
User
Posts: 36
Joined: Fri Jan 05, 2018 8:36 pm

Determining Which Bookmark Selected In Bookmark Pane

Post by plgoldman »

I have been trying to figure this one out for several days now. I've researched the documentation an forums but have not been able to find an event to capture or a property to query to pass me the bookmark in the bookmark pane that an end user has clicked on. I know that clicking on a bookmark raises the "e.pagesView.currentPageChange" event but other that the "go to" page no bookmark information seems to be available. When a document is first open the "e.documentView.activated" event is raised and at that time I build a list of bookmarks as follow.

Code: Select all

                    bookMarkList1 = new List<PDFXEdit.IPXC_Bookmark>();
                    PDFXEdit.IPXC_Document doc = pdfCtl.Doc.CoreDoc;
                    PDFXEdit.IPXC_Bookmark bookMarks = doc.BookmarkRoot;
                    PDFXEdit.IPXC_Bookmark bookMark1 = bookMarks.FirstChild;
                    bookMarkList1.Add(bookMark1);
                    for (uint i = 0; i < bookMarks.ChildrenCount - 1; i++)
                    {
                        bookMark1 = bookMark1.Next;
                        bookMarkList1.Add(bookMark1);
                    }     
My thought was that if I could capture the selected bookmark I could use the List<PDFXEdit.IPXC_Bookmark> to match on "Title" and extract needed information.

Your help, as always, is appreciated.

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

Re: Determining Which Bookmark Selected In Bookmark Pane

Post by Sasha - Tracker Dev Team »

Hello Paul,

You will have to catch the https://sdkhelp.pdf-xchange.com/vi ... on_changed event and see whether the Bookmark Selection is available/active selection (depends on your causes). Here are more details:
viewtopic.php?f=66&t=29742&p=117619&hil ... on#p117619

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
plgoldman
User
Posts: 36
Joined: Fri Jan 05, 2018 8:36 pm

Re: Determining Which Bookmark Selected In Bookmark Pane

Post by plgoldman »

Alex,

Once more thanks for your prompt response and very useful suggested approach. This code i ended up creating is as follows:

Code: Select all

                
                case "e.docSelection.changed":
                    PDFXEdit.IPXV_BookmList bookMarkList2 = null;
                    int nSel = pdfCtl.Inst.Str2ID("selection.bookmarks");
                    PDFXEdit.IPXV_DocSelection docSel = pdfCtl.Doc.GetSel(nSel);
                    PDFXEdit.IPXV_BookmSelection bkMkSelection = (PDFXEdit.IPXV_BookmSelection)docSel;
                    bookMarkList2 = bkMkSelection.Items;
                    if (bookMarkList2.Count > 0)
                    {
                        // process bookmark contents here
                    }
                    break;
                    
The end user clicks on one bookmark and "bookMarkLiks2[0]" gives me the bookmark I'm looking for.

Thanks again.
Regards,
Paul
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Determining Which Bookmark Selected In Bookmark Pane

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply