Ekspor Bookmark ke XML dari File PDF yang Ada (facades)
Contents
[
Hide
]
Metode exportBookmarksToXml memungkinkan Anda untuk mengekspor bookmark dari file PDF ke file XML.
Untuk mengekspor bookmark:
- Buat objek PdfBookmarkEditor dan ikat file PDF menggunakan metode bindPdf.
- Panggil metode exportBookmarksToXml.
Cuplikan kode berikut menunjukkan kepada Anda cara mengekspor bookmark ke file XML.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |