Bookmarks not retained when PDF is saved in Adobe

I adding one bookmark to the attached PDF as follows: (Aspose PDF 7.3)


Aspose.Pdf.License lic = new Aspose.Pdf.License();
lic.SetLicense(@“Aspose.PDF.lic”);
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(@“Test.pdf”);

Aspose.Pdf.OutlineItemCollection introBm = new Aspose.Pdf.OutlineItemCollection(doc.Outlines);
introBm.Title = “Page 3”;
introBm.Destination = new Aspose.Pdf.InteractiveFeatures.GoToAction(3);
doc.Outlines.Add(introBm);

doc.Save(@“Test-Bookmark.pdf”);

I note that when this PDF is subsequently opened and saved in Adobe Professional (without making any changes to the document) then the bookmark remains but it no longer works, i.e. it no longer opens the specified page.

I have also noted that when adding a document in Adobe Professional to a PDF generated using Aspose.PDF, then all bookmarks below the new document disappear.

I’ve been playing around with this and it works if I create the Bookmarks as follows:


introBm.Destination = Aspose.Pdf.InteractiveFeatures.ExplicitDestination.CreateDestination(doc.Pages[pageNum], Aspose.Pdf.InteractiveFeatures.ExplicitDestinationType.Fit, new double[] { });

Maybe there is some small difference in how both of these methods create bookmarks in the pdf?

Hi James,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file.

I am able to reproduce your mentioned issue after an initial test regarding bookmarks are not retained after saving the file using Adobe Professional (I used Adobe X for testing purpose). Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-34284 for rectification. You will be notified via this forum thread regarding any updates against your issue.

Sorry for the inconvenience,

Hi James,


Thanks for your patience.

We have further investigated this issue and have found that in order to correct this problem, please try using Action property of OutlineItemCollection instead of Destination. Please try using the following code snippet.

[C#]

Aspose.Pdf.Document doc = new
Aspose.Pdf.Document(@“D:\pdftest\Test_bookmarks.pdf”);<o:p></o:p>

Aspose.Pdf.OutlineItemCollection introBm = new Aspose.Pdf.OutlineItemCollection(doc.Outlines);

introBm.Title = "Page 3";

//introBm.Destination = new Aspose.Pdf.InteractiveFeatures.GoToAction(3);

introBm.Action = new Aspose.Pdf.InteractiveFeatures.GoToAction(doc.Pages[3]);

doc.Outlines.Add(introBm);

doc.Save(@"D:\pdftest\Test_bookmarks_v750.pdf");

The issues you have found earlier (filed as PDFNEWNET-34284) have been fixed in Aspose.Pdf for .NET 7.5.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.