Reading Bookmarks
Foxit PDF SDK for Android provides reading bookmark create, read, edit, and delete through the Core SDK. Reading bookmarks differ from PDF outlines: they are application-level bookmarks stored in document Catalog metadata (XML), used to mark pages of interest and jump back quickly.
Built-in reading bookmarks panel in UI Extensions
If you use the full reader (UI Extensions), reading bookmarks are built into the side panel (ReadingBookmarkModule); users can add, view, and jump to reading bookmarks. No extra code is required.
Core Classes
| Class | Description |
|---|---|
ReadingBookmark | Reading bookmark; title, page index, and timestamp |
Manage reading bookmarks with PDFDoc methods: getReadingBookmarkCount(), getReadingBookmark(), insertReadingBookmark(), and removeReadingBookmark().
Example: Add, List, and Remove Reading Bookmarks
java
import com.foxit.sdk.pdf.PDFDoc;
import com.foxit.sdk.pdf.ReadingBookmark;
import com.foxit.sdk.common.DateTime;
PDFDoc doc = new PDFDoc("path/to/Sample.pdf");
doc.load(null);
// Insert at end
int count = doc.getReadingBookmarkCount();
ReadingBookmark newBookmark = doc.insertReadingBookmark(count, "重要内容", 5);
// Set creation time
DateTime now = new DateTime();
newBookmark.setDateTime(now, true);
// List all reading bookmarks
count = doc.getReadingBookmarkCount();
for (int i = 0; i < count; i++) {
ReadingBookmark bookmark = doc.getReadingBookmark(i);
if (bookmark.isEmpty()) continue;
String title = bookmark.getTitle();
int pageIndex = bookmark.getPageIndex();
DateTime creationTime = bookmark.getDateTime(true);
DateTime modifiedTime = bookmark.getDateTime(false);
}
// Remove first reading bookmark
if (count > 0) {
ReadingBookmark first = doc.getReadingBookmark(0);
doc.removeReadingBookmark(first);
}
doc.saveAs("path/to/output.pdf", PDFDoc.e_SaveFlagNormal);API Reference
See the API Reference for full ReadingBookmark documentation.