Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Problem with SetOutlineNamedDestination
  FAQ FAQ  Forum Search   Register Register  Login Login

Problem with SetOutlineNamedDestination

 Post Reply Post Reply
Author
Message
robbo969 View Drop Down
Beginner
Beginner


Joined: 25 Jul 12
Location: UK
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote robbo969 Quote  Post ReplyReply Direct Link To This Post Topic: Problem with SetOutlineNamedDestination
    Posted: 06 Nov 13 at 11:06PM
Hi all,

I am trying to upgrade bookmarks to proper named destinations so I can link to them from a web page. I can step through the bookmarks and retrieve their IDs and names and then call to  SetOutlineNamedDestination(ID, Name) and I get the correct response 1 (= success) but when I try and read back the NamedDestinations or save the file they're lost.

Has anyone had experience with SetOutlineNamedDestination either good or bad. Am I missing a step to commit the information to the file before saving?

Regards,
Graeme
Back to Top
robbo969 View Drop Down
Beginner
Beginner


Joined: 25 Jul 12
Location: UK
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote robbo969 Quote  Post ReplyReply Direct Link To This Post Posted: 07 Nov 13 at 1:01PM
For info, the code looks like the attached and seems to complete with the correct responses...

            string strStartingFilename = @"C:\_Testing\v3_0\HTML\files\C\_Catalyst_Demos\__BidExample\Executive Summary\Executive Summary.pdf";
            string strFinalFilename    = @"C:\_Testing\v3_0\HTML\files\C\_Catalyst_Demos\__BidExample\Executive Summary\GRs_cSharp_Edit.pdf";
            string strKey              =  "xyz";
            

            DebenuPDFLibraryAX0911.PDFLibrary PDFLib = new DebenuPDFLibraryAX0911.PDFLibrary();

            //Unlock the library
            int InstanceID = PDFLib.UnlockKey(strKey);

            // Open the file
            int iLoadFile = PDFLib.LoadFromFile(strStartingFilename, "");

            // Now we need some readings from the file
            int docCount      = PDFLib.DocumentCount();
            int iAnnotations  = PDFLib.AnnotationCount();
            int iPages        = PDFLib.PageCount();
            int iOutlineCount = PDFLib.OutlineCount();

            string strReport = "";
            string BMName = "";
            int x;
            int iOutlineID;
            int iReturn;

            iOutlineID = PDFLib.GetOutlineID(3);

            BMName = PDFLib.OutlineTitle(iOutlineID);


            for ( x = 0; x < iOutlineCount; x++ ) 
            {

                PDFLib.SelectDocument(iLoadFile);

                iOutlineID = PDFLib.GetOutlineID(x);
 
                BMName = PDFLib.OutlineTitle(iOutlineID);

                if (BMName != "" && BMName != null) 
                {             
                    
                    strReport = strReport + ", " + BMName;


                    iReturn = PDFLib.SetOutlineNamedDestination(iOutlineID, BMName);
                    if (iReturn == 1)
                    {
                        MessageBox.Show("Created Destination '" + BMName + "'");
                        strReport = strReport + ", " + BMName;
                    }
                    else
                    {
                        MessageBox.Show("Can't create Destination '" + BMName + "'");
                    }
                }


            }


            MessageBox.Show( strReport);

            PDFLib.SaveToFile(strFinalFilename);
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 13 at 5:15AM
Hi robbo969,

I've tested your code on my end and it appears to be working correctly with the slight issue that the for loop should be 'less than or equal to' so that it doesn't miss the last outline and it is not currently creating the new named destinations.

Here's a modification that creates the new named destinations before you set the outline to look for that named destination:

if (BMName != "" && BMName != null)
                {

                    strReport = strReport + ", " + BMName;

                    // Start mod: You need to create the named destination
                    // before you assign the outline to it

                    int iDestID = DPL.GetOutlineDest(iOutlineID);
                    DPL.NewNamedDestination(BMName, iDestID);                   

                    // Finish mod

                    iReturn = DPL.SetOutlineNamedDestination(iOutlineID, BMName);
                    if (iReturn == 1)
                    {
                        MessageBox.Show("Created Destination '" + BMName + "'");
                        strReport = strReport + ", " + BMName;
                    }
                    else
                    {
                        MessageBox.Show("Can't create Destination '" + BMName + "'");
                    }
                }

I hope this helps.

Cheers,
- Rowan.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store