|Developer Tools||Office Productivity Applications
PDFOne .NET Bookmark has been discontinued. It was a function-based subset edition of PDFOne .NET. PDFOne .NET has more features and is our flagship .NET product.
Today, quite a lot of applications offer a PDF export option. PDF documents created in this manner can score higher in the usability scale if they were to have bookmarks.
In situations such as this, Gnostice PDFOne .NET Bookmark can help. Being a one-stop solution for PDF bookmark management, PDFOne .NET Bookmark covers everything from creating/deleting bookmarks to modifying/enhancing bookmarks.
Essentially, PDFOne .NET Bookmark can load a PDF document, parse its bookmark hierarchy and perform various kinds of bookmark-related tasks. Now, here is an example code snippet that does all this and more. Please follow my code comments closely.
// Creates a PDF document object PDFDocument doc = new PDFDocument(); // Loads an existing PDF document doc.Load("Bookmarks.pdf"); // Gets first bookmark in the above document PDFBookmark Bookmark1 = doc.GetFirstBookmark(); // Changes the color of the first bookmark Bookmark1.Color = Color.Red; // Gets the second bookmark in the document PDFBookmark Bookmark2 = Bookmark1.GetNext(); // Changes display style of the second bookmark // to bold text Bookmark2.Style = PDFBookmarkStyle.Bold;
In the above code snippet, we were able to get hold of the bookmark hierarchy by first calling
PDFDocument.GetFirstBookmark() method, which returns a bookmark object referring to the first bookmark in the hierarchy.
Then, we could parse the bookmark hierarchy or tree by calling the
PDFBookmark.GetNext() method. Lower down the tree, we could have called
PDFBookmark.GetPrevious() to move up bookmarks in the hierarchy.
To parse bookmarks at different levels in the hierarchy, we have a
PDFBookmark.GetFirstChild() method, as illustrated in the following code snippet.
// Gets first child bookmark PDFBookmark Bookmark1_Child1 = Bookmark1.GetFirstChild(); // Changes text used to display the child bookmark Bookmark1_Child1.Title = "Modified";
Sometimes, we need to bid adieu to some bookmarks. Here, we either go to the bookmark immediately below or immediately above the one we want to let go and delete the one we want to let go by calling
// Gets next bookmark PDFBookmark Bookmark4 = Bookmark3.GetNext(); // Deletes previous bookmark Bookmark4.RemovePrevious(); // Bookmark3 is deleted
To jump to the parent node of a given bookmark and delete the first child node, you first go to the parent of the current bookmark and then delete the first child bookmark.
// Gets parent bookmark PDFBookmark Bookmark5_Parent = Bookmark5.GetParentNode(); // Deletes first child bookmark of the parent bookmark Bookmark5_Parent.RemoveFirstChild(); // Removes Bookmark5
// Adds a URI action to a bookmark Bookmark6.AddActionURI("www.gnostice.com");
You have learnt about the capabilities of PDFOne .NET Bookmark. Now, here is what we did in a sample PDF bookmark editor application we created using PDFOne .NET Bookmark.
|Our .NET Developer Tools|
Multi-format document-processing component suite for .NET developers.
A .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications.
|Our Delphi/C++Builder developer tools|
Multi-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms.
A Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools.
A Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents.
|Our Java developer tools|
Multi-format document-processing component suite for Java developers.
A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications.
|Our Platform-Agnostic Cloud and On-Premises APIs|
Cloud-hosted and On-Premises REST-based document-processing and document-viewing APIs
|Privacy | Legal | Feedback | Newsletter | Blog | Resellers||© 2002-2022 Gnostice Information Technologies Private Limited. All rights reserved.|