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.
Related Docs Links
Ready to get started? Version: 2024.10 just released