Hello,
I implemented add outline like this:
public boolean addToBookmarks() {
boolean success;
float top = mDocument.GetPageHeight(0);
Document.Outline outline = mDocument.GetOutlines();
if (outline == null) {
success = mDocument.NewRootOutline(String.valueOf(mCurrentPage), mCurrentPage, top);
if (success) {
pdfSave();
outline = mDocument.GetOutlines();
}
}
success = outline != null && outline.AddChild(String.valueOf(mCurrentPage), mCurrentPage, top);
if (success) {
success = pdfSave();
}
return success;
}
The problem is when i close the PDF after adding outlines and re-open it i can not get the outlines:
private void fetchOutlines() {
if (mDocument == null) return;
Document.Outline outline = mDocument.GetOutlines();//first root is always null
fetchOutlines(outline);
}
private void fetchOutlines(Document.Outline outline) {
while (outline != null) {
Toast.makeText(mActivity, "" + outline.GetDest(), Toast.LENGTH_SHORT).show();
mOutlines.add(outline);
Document.Outline child = outline.GetChild();
if (child != null) {
fetchOutlines(child);
}
outline = outline.GetNext();
}
}