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!
![]() |
Problem with SetOutlineNamedDestination |
Post Reply
|
| Author | |
robbo969
Beginner
Joined: 25 Jul 12 Location: UK Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
Topic: Problem with SetOutlineNamedDestinationPosted: 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
|
|
![]() |
|
robbo969
Beginner
Joined: 25 Jul 12 Location: UK Status: Offline Points: 5 |
Post Options
Thanks(0)
Quote Reply
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); |
|
![]() |
|
Rowan
Moderator Group
Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store