using IronPdf;
// Create a new PDF or edit an existing document.
var pdf = PdfDocument.FromFile("existing.pdf");
// Add bookmark
pdf.Bookmarks.AddBookMarkAtEnd("Author's Note", 2);
pdf.Bookmarks.AddBookMarkAtEnd("Table of Contents", 3);
// Store new bookmark in a variable to add nested bookmarks to
var summaryBookmark = pdf.Bookmarks.AddBookMarkAtEnd("Summary", 17);
// Add a sub-bookmark within the summary
var conclusionBookmark = summaryBookmark.Children.AddBookMarkAtStart("Conclusion", 18);
// Add another bookmark to end of highest-level bookmark list
pdf.Bookmarks.AddBookMarkAtEnd("References", 20);
// Remove bookmark example
pdf.Bookmarks.RemoveBookMark(summaryBookmark);
pdf.SaveAs("existing.pdf");
Imports IronPdf
' Create a new PDF or edit an existing document.
Private pdf = PdfDocument.FromFile("existing.pdf")
' Add bookmark
pdf.Bookmarks.AddBookMarkAtEnd("Author's Note", 2)
pdf.Bookmarks.AddBookMarkAtEnd("Table of Contents", 3)
' Store new bookmark in a variable to add nested bookmarks to
Dim summaryBookmark = pdf.Bookmarks.AddBookMarkAtEnd("Summary", 17)
' Add a sub-bookmark within the summary
Dim conclusionBookmark = summaryBookmark.Children.AddBookMarkAtStart("Conclusion", 18)
' Add another bookmark to end of highest-level bookmark list
pdf.Bookmarks.AddBookMarkAtEnd("References", 20)
' Remove bookmark example
pdf.Bookmarks.RemoveBookMark(summaryBookmark)
pdf.SaveAs("existing.pdf")
Install-Package IronPdf
Outlines & Bookmarks
A PDF outline or "bookmark" adds a way to navigate to key pages of a PDF. In Adobe Acrobat Reader, these bookmarks (which may be nested) are shown in the application's left sidebar. IronPDF will import existing bookmarks from PDF documents and allow more to be added, edited, and nested. To learn more about how IronPDF can enhance your PDF functionalities, visit the IronPDF Product Page. For comprehensive insights into how Iron Software’s suite of products can address your document processing needs, explore the Iron Software Official Website.
Related Docs Links
Ready to get started? Version: 2024.12 just released