Hello,
There is an issue with bookmarks in PDF files generated using Aspose.PDF version 25.2 and above. The bookmarks are not displayed correctly when the PDF is opened using the Adobe Acrobat browser extension:
image.png (2.3 KB)
However, they appear correctly in the desktop version of Adobe Acrobat Reader and when opened directly in a browser:
image.png (1.6 KB)
Here’s the code snippet:
void Main()
{
Document pdfDocument = new Document();
Page page1 = pdfDocument.Pages.Add();
TextFragment text1 = new TextFragment("This is the first page");
page1.Paragraphs.Add(text1);
Page page2 = pdfDocument.Pages.Add();
TextFragment text2 = new TextFragment("This is the second page");
page2.Paragraphs.Add(text2);
Page page3 = pdfDocument.Pages.Add();
TextFragment text3 = new TextFragment("This is the third page");
page3.Paragraphs.Add(text3);
OutlineItemCollection mainBookmark = new OutlineItemCollection(pdfDocument.Outlines);
mainBookmark.Title = "Main Section";
mainBookmark.Italic = true;
mainBookmark.Bold = true;
OutlineItemCollection subBookmark1 = new OutlineItemCollection(pdfDocument.Outlines);
subBookmark1.Title = "Page 1";
subBookmark1.Action = new GoToAction(page1);
mainBookmark.Add(subBookmark1);
OutlineItemCollection subBookmark2 = new OutlineItemCollection(pdfDocument.Outlines);
subBookmark2.Title = "Page 2";
subBookmark2.Action = new GoToAction(page2);
mainBookmark.Add(subBookmark2);
OutlineItemCollection subBookmark3 = new OutlineItemCollection(pdfDocument.Outlines);
subBookmark3.Title = "Page 3";
subBookmark3.Action = new GoToAction(page3);
mainBookmark.Add(subBookmark3);
pdfDocument.Outlines.Add(mainBookmark);
pdfDocument.Save(@"D:\temp\test.pdf");
}
Using the same code with Aspose.PDF version 25.1, the bookmarks display correctly in the browser extension.
Could you provide guidance on resolving this issue? Is there a known solution or any planned fixes?
Thank you for your assistance.
Best regards,
Artur