Working with Bookmarks - facades

Create Bookmarks of All Pages (facades)

The following code snippet shows you:

Create Bookmarks of All Pages with Properties (facades)

The following code snippet shows you how to create bookmarks of all the pages with properties.

Export Bookmarks to XML from an Existing PDF File (facades)

To export bookmarks:

  1. Create a PdfBookmarkEditor object and bind the PDF file using the bindPdf method.
  2. Call the exportBookmarksToXml method.

The following code snippet shows you how to export bookmarks to an XML file.

From Aspose.PDF for Java 9.0.0, the PdfBookmarkEditor class implements the exportBookmarksToXML and importBookmarksWithXML methods with Stream arguments. As a result, extracted bookmarks can be saved to a stream object.

Import Bookmarks from XML to an Existing PDF File (facades)

To import bookmarks:

  1. Create a PdfBookmarkEditor object and bind the PDF file using the bindPdf method.
  2. Call the importBookmarksWithXml method.
  3. Save the updated PDF file using the save method.

The following code snippet shows how to import bookmarks from an XML file.

From Aspose.PDF for Java 9.0.0, the PdfBookmarkEditor class implements the exportBookmarksToXML and importBookmarksWithXML methods with Stream arguments. As a result, extracted bookmarks can be imported from a stream object.