Hello everybody,
I used BmDatabase class to let the user add bookmarks to pdf files. The bookmarks are saved in a sqlite file placed in the application's internal directory. I also show the added bookmarks in a list while the pdf file is opened. Everything works well except for one thing: when the user closes and opens the same pdf again, the last bookmark that was saved is not shown anymore. So for example, if the user adds just one bookmark the first time they open the pdf file, none is shown after the same pdf is re-opened; if they add two bookmarks, only the first one is shown after the same pdf is re-opened. Could you please tell me what I am doing wrong?
This is the code I'm using to save a bookmark:
int recordAdd = bmDatabase.RecOpen(bookmarkDbFilePath);
int pageAdd = m_reader.GetCurrentPageNumber();
String bookmarkName = "Page " + (pageAdd + 1);
boolean success = bmDatabase.RecItemInsert(recordAdd, bookmarkName, pageAdd);
bmDatabase.RecClose(recordAdd);
if (success) {
// Refresh the bookmark list: this works fine, success is true every time and the list is always refreshed
// ...
}
This is the code I'm using to read the saved bookmarks when I open the pdf file:
bookmarkDbFilePath = getFilesDir() + File.separator + fileName; // fileName includes .sqlite extension
int records = bmDatabase.RecOpen(bookmarkDbFilePath);
int count = bmDatabase.RecGetCount(records);
for (int i = 0; i < count; i++) {
String name = bmDatabase.RecItemGetName(records, i);
int pageno = bmDatabase.RecItemGetPage(records, i);
ActionItem item = new ActionItem(i, name, pageno, null);
quickAction.addActionItem(item);
}
bmDatabase.RecClose(records);
N.B.: "count" here is one less than it should be (i.e. if the user previously added 4 bookmarks, count is 3).
Last but not least, I am confused about the type of license I need to make the bookmarks work. Is the Standard license enough?
Thanks in advance for your help.