Retaining Bookmarks

Hi, we use Aspose.PDF to pull out indiviudal pages from a PDF and then recombine them. In some instances we recombine all the pages of the oringial PDF, and in other instances we split it into mutiple PDFs. What we noticed is that the bookmarks disappear. How can we retain the bookmarks from the original PDF?

@ashnin816

The bookmarks exist at document level and when you remove or extract pages from the document, the bookmarks do not get extracted along with them. You will need to add bookmarks separately in the newly generated PDF document. However, if you are combining two or more PDF files, you can keep bookmarks intact using the below code:

Facades.PdfFileEditor pfe = new Facades.PdfFileEditor();
pfe.CopyLogicalStructure = true;
pfe.CopyOutlines = true;
//pfe.KeepActions = true;
pfe.Concatenate(dataDir + "1.pdf", dataDir + "2.pdf", dataDir + "result.pdf");