Hello,
Hi Eric,
Thanks for contacting support.
Please visit the following link for required information on Import and Export Bookmarks. The code snippet in shared link shows the steps to import the bookmark in existing PDF file and in case you need to import it into new PDF document, you can create a document from scratch using Document instance, add page object to pages collection of PDF file, pass this object to PdfBookmarkEditor class and then import the bookmarks inside it.
[C#]
// Create Document instance
Document doc = new Document();
// add page to PDF file
doc.Pages.Add();
// Create PdfBookmarkEditor class>
Aspose.Pdf.Facades.PdfBookmarkEditor
bookmarkEditor = new Aspose.Pdf.Facades.PdfBookmarkEditor();
// Open PDF file
bookmarkEditor.BindPdf(doc);
// Import bookmarks
bookmarkEditor.ImportBookmarksWithXML(dataDir + “bookmarks.xml”);//Save updated PDF file
bookmarkEditor.Save(dataDir + "ImportFromXML_out.pdf");
Thank you Nayyer!
And perhaps I should explain the scope of my project, maybe it will help.
I am all set on this, I was able to get my code working. The piece I was missing was while looping through the Aspose.Pdf.Facades.Bookmark collection, I had to use the PageNumber and Destination to access the Aspose.Pdf.Page to add it to the new Aspose.Pdf.Document.
Hi Eric,
Hi Eric,eforden:I am all set on this, I was able to get my code working. The piece I was missing was while looping through the Aspose.Pdf.Facades.Bookmark collection, I had to use the PageNumber and Destination to access the Aspose.Pdf.Page to add it to the new Aspose.Pdf.Document.