Bookmarks make navigation easier in large documents. Readers can easily jump between different pages and sections, instead of scrolling through the whole document. Aspose.PDF Cloud API offers many PDF manipulation features. Working with Bookmarks is one of the commonly used features of the API. In this blog, we will be learning the following use cases:

  • Add bookmarks in PDF documents
  • Delete bookmarks in PDF document
  • Update bookmarks in PDF document

Aspose.PDF Cloud API supports a lot of programming languages including C#, Java, Python, Go, Ruby, PHP, and many more. Respective SDKs are available for your convenience. You can simply integrate any of the SDKs into your applications as the SDK will take care of minor details related to requests and responses. This enables you to focus on the major features you want to include in your application. Let us move on to bookmark related features in .NET applications:

Add Bookmarks in PDF Document

Sometimes adding bookmarks is necessary criteria while submitting documents, for example, legal filings. In such scenarios, your applications can be sufficient to cater to all of your needs. You simply need to specify the attributes or properties of the Bookmark and send the request to insert the bookmark in the PDF file. Below C# code is a demonstration of using this feature:

Here almost all attributes of Bookmark class are self-explanatory. However, the bookmarkPath parameter points to the parent bookmark in the tree. If you want to add a bookmark to the root, you must specify an empty string as the path. Following is a screenshot of the output PDF document with a bookmark added by the above code snippet.

Bookmarks in PDF

Delete Bookmark in PDF Document

It is important to note here that deleting a parent bookmark will delete all of its child bookmarks as well. However, deleting a bookmark does not delete any text or any part of the document. Let us learn this by an example in C# language:

You can notice that we simply need to specify bookmarkPath property, as explained above, before calling the API.

Update Bookmarks in PDF Document

You may need to update bookmarks in PDF documents by renaming a bookmark, update destination, or the appearance. The API is advanced enough to support these features as well. Below code snippet can be used to update bookmarks:

Curious for other features offered by the API? You can explore some of the possibilities in API documentation. If you want to test the API in its full capacity, then Sign Up for free and use the API with the generous free trial. If you have got any inquiry then feel free to get in touch with us via Free Support Forums.

Related Post

Split PDF File into Multiple Files using C# .NET