PDF bookmarks allow you to quickly jump to a specific portion in the document to which they are linked. That portion of the document could be any page or section in the PDF file. Below step by step guide will teach you how to read bookmarks in PDF using C#.
Steps to Read Bookmarks in PDF using C#
- Download and Install Aspose.PDF for .NET from NuGet.org
- Include Aspose.PDF namespace with using directives
- Set API license by calling SetLicense method
- Initialize Document Class with existing PDF containing bookmarks
- Loop through the OutlineItemCollection to read PDF bookmarks
- Write the information of extracted bookmarks to the Console
Functionality to retrieve PDF bookmarks using C# can easily be achieved using the above simple steps. Besides the feature to flatten PDF form fields in C#, the API also allows you to extract bookmarks in PDF with information like title, font style, color, etc. You can print this information in the console output by iterating through the OutlineItemCollection and reading the PDF bookmarks as shown in the below code snippet.
Code to Read Bookmarks in PDF using C#
The above simple code snippet extracts PDF bookmarks as well as child bookmarks if there are any in the provided PDF document. You can use it in your Desktop, Console, or any other .NET Application to achieve your requirements of reading PDF bookmarks using C#.