Id like to use mupdf as a pdf viewer inside my own android app.
Ive been able to compile it (not easy) from instructions here , the last steps were :
ndk-build
ant debug
Now, how to call mupdf from my android project in eclipse ?
I just want to open a window with a specified PDF and a custom toolbar.
The mupdf.c is a wrapper of the native code, and the function that can be called by java code must have prefix such as com_artifex_mupdf_MuPDFCore
.
In its function name Java_com_artifex_mupdf_MuPDFCore_openFile
, com_artifex_mupdf_MuPDFCore
is exactly the package name of the java code which declared the native functions, check out MuPDFCore.java, each native function are declared by using native
keyword. Then you can use these functions like normal java methods.
BTW, mupdf is NOT thread safe, your JNI java code should be careful to use synchronized. The open source project VuDroid is also a good example to learn how to interact with mupdf via JNI.