Skip to content

Instantly share code, notes, and snippets.

@Mygod
Last active August 29, 2015 14:13
Show Gist options
  • Save Mygod/8d403d11fa0ddfdcf258 to your computer and use it in GitHub Desktop.
Save Mygod/8d403d11fa0ddfdcf258 to your computer and use it in GitHub Desktop.
DjVu bookmarks exporter

DjVu bookmarks exporter

Usage:

  • Edit file:///path/to/file.djvu;
  • Compile;
  • Run with pipe >output.txt;
  • Done!

Dependencies

http://sourceforge.net/projects/libdjvu/

Additional compiler options

-DDLL_EXPORT

Additional notes

You might need to remove virtual in some file in libdjvu if linker fails.

#include <cstdio>
#include "libdjvu/DjVmNav.h"
#include "libdjvu/DjVuDocument.h"
int main(int argc, char** argv) {
GUTF8String urlStr("file:///path/to/file.djvu");
GURL url(urlStr);
GP<DjVuDocument> doc = DjVuDocument::create(url);
doc->wait_for_complete_init();
GP<DjVmNav> nav = doc->get_djvm_nav();
int count = nav->getBookMarkCount();
for (int i = 0; i < count; ++i) {
GP<DjVmNav::DjVuBookMark> bookmark;
nav->getBookMark(bookmark, i);
printf("%s\n", (const char*) bookmark->displayname);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment