// Open document
Document pdfDocument = new Document("input.pdf");
// Create a bookmark object
OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.Outlines);
pdfOutline.Title = "Test Outline";
pdfOutline.Italic = true;
pdfOutline.Bold = true;
// Set the destination page number
pdfOutline.Action = new Aspose.Pdf.InteractiveFeatures.GoToAction(pdfDocument.Pages[1]);
// Add bookmark in the document's outline collection.
pdfDocument.Outlines.Add(pdfOutline);// Save output
pdfDocument.Save("output.pdf");
// Open document
Document pdfDocument = new Document("input.pdf");
// Loop through all the bookmarks
foreach (OutlineItemCollection outlineItem in pdfDocument.Outlines){
Console.WriteLine(outlineItem.Title);Console.WriteLine(outlineItem.Italic);Console.WriteLine(outlineItem.Bold);Console.WriteLine(outlineItem.Color);
}
Document pdfDocument = new Document(myDir+"test.pdf");
int pageNumber1 = pdfDocument.Destinations.GetPageNumber("UntitledDestination", false);