Ekspor Bookmark ke XML dari File PDF yang Ada (facades)

Contents
[ ]

Untuk mengekspor bookmark:

  1. Buat objek PdfBookmarkEditor dan ikat file PDF menggunakan metode bindPdf.
  2. Panggil metode exportBookmarksToXml.

Cuplikan kode berikut menunjukkan kepada Anda cara mengekspor bookmark ke file XML.

// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Java
// Create PdfBookmarkEditor object
PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
// Open PDF file
bookmarkEditor.bindPdf("Input.pdf");
// Export bookmarks
bookmarkEditor.exportBookmarksToXML("bookmarks.xml");
bookmarkEditor.dispose();

Dari Aspose.PDF untuk Java 9.0.0, kelas PdfBookmarkEditor mengimplementasikan metode exportBookmarksToXML dan importBookmarksWithXML dengan argumen Stream. Akibatnya, penanda buku yang diekstraksi dapat disimpan ke objek stream.

// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Java
// Create PdfBookmarkEditor object
PdfBookmarkEditor bookmarkeditor = new PdfBookmarkEditor();
// Open PDF file
bookmarkeditor.bindPdf("Input.pdf");
OutputStream os = new FileOutputStream("bookmark.xml");
bookmarkeditor.exportBookmarksToXML(os);
bookmarkeditor.dispose();