Bookmarks with Childs

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Chris - Tracker Supp, 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
edvschu
User
Posts: 122
Joined: Fri Jun 25, 2010 6:54 am

Bookmarks with Childs

Post by edvschu » Mon Dec 12, 2016 10:18 am

Hello,

i want add bookmarks with childs into pdf. How can i do that in C#?

Best Regards,
edvschu

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

Re: Bookmarks with Childs

Post by Tracker Supp-Stefan » Mon Dec 12, 2016 10:53 am

Hello edvschu,

Please take a look at this help page describing all the methods and properties of the bookmark interface:
http://sdkhelp.tracker-software.com/vie ... C_Bookmark

Regards,
Stefan

edvschu
User
Posts: 122
Joined: Fri Jun 25, 2010 6:54 am

Re: Bookmarks with Childs

Post by edvschu » Wed Dec 14, 2016 9:04 am

I found a sample for editor in help. For core i do it so:

Code: Select all

Private Sub AddBookmark()
        Dim pDoc As PDFXCoreAPI.IPXC_Document = OpenDocumentFromFile(sFileAddBookmark, pdfInst)
        If pDoc Is Nothing Then
            Return
        End If

        Dim bmRoot As PDFXCoreAPI.IPXC_Bookmark = Nothing
        Dim bmLevel1 As PDFXCoreAPI.IPXC_Bookmark = Nothing
        Dim bmLevel2 As PDFXCoreAPI.IPXC_Bookmark = Nothing
        Dim bm As PDFXCoreAPI.IPXC_Bookmark = Nothing
        Dim dest As PDFXCoreAPI.PXC_Destination = Nothing
        Dim al As PDFXCoreAPI.IPXC_ActionsList = Nothing
        Dim page As UInteger = 0

        bmRoot = pDoc.BookmarkRoot
        If bmRoot IsNot Nothing Then
            bmLevel1 = bmRoot

            page = 3
            bm = bmLevel1.AddNewChild(True)
            bm.Title = "Bookmark Level 1"
            dest = New PDFXCoreAPI.PXC_Destination
            dest.nPageNum = Convert.ToUInt32(page - 1)
            dest.nNullFlags = 15
            dest.nType = PDFXCoreAPI.PXC_DestType.Dest_XYZ
            al = pDoc.CreateActionsList()
            al.AddGoto(dest)
            bm.Actions = al

            bmLevel2 = bm

            '#################################################################

            page = 6
            bm = bmLevel2.AddNewChild(True)
            bm.Title = "Bookmark Level 2"
            dest = New PDFXCoreAPI.PXC_Destination
            dest.nPageNum = Convert.ToUInt32(page - 1)
            dest.nNullFlags = 15
            dest.nType = PDFXCoreAPI.PXC_DestType.Dest_XYZ
            al = pDoc.CreateActionsList()
            al.AddGoto(dest)
            bm.Actions = al
        End If

        pDoc.WriteToFile(sFileAddBookmark)
        pDoc.Close()
End Sub
One is still missing. How can I delete all bookmarks of a document? There is a sample for editor, but how I do this with the core?

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

Re: Bookmarks with Childs

Post by Sasha - Tracker Dev Team » Wed Dec 14, 2016 9:38 am

Hello edvschu,

Well if there is an Add method there should be a method that removes the child bookmarks. Though it's name is not Remove - the Unlink method of the IPXC_Bookmark interface allows you to remove the bookmark from it's parent.

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

Post Reply