I do not know how to do this on Windows using cygwin, because I use Ubuntu for development. But I think the procedure should be the same.
- Download the mupdf-0.9-source.tar.gz file here: http://code.google.com/p/mupdf/downloads/list?q=source
- Download the mupdf-thirdparty.zip file
- Extract the sources. By default they will be extracted to the folder: mupdf-0.9 /
- Extract the mupdf-thirdparty.zip file to the mupdf-0.9 folder /
- Create a mupdf-0.9 project (for windows you should use VS as it is declared in readme files)
- Then go to the mupdf-0.9 / android / folder
- Run ndk-build
- You may receive the following errors:
Compile thumb : mupdfthirdparty <= jbig2.c In file included from /home/yury/programming/android/workspace/mupdf-0.9/android/jni/../../thirdparty/jbig2dec/os_types.h:53, from /home/yury/programming/android/workspace/mupdf-0.9/android/jni/../../thirdparty/jbig2dec/jbig2.c:22: /home/yury/software/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdint.h:48: error: redefinition of typedef 'int8_t' /home/yury/programming/android/workspace/mupdf-0.9/android/jni/../../thirdparty/jbig2dec/os_types.h:47: note: previous declaration of 'int8_t' was here
The solution is explained here: mupdf for android: ndk-build problem (error: overdefining typedef ....) However, you can just comment on the type definition lines in the file / thirdparty / jbig 2dec / os_types.h
After that, you will get two libraries: one static and one shared for your Android application.
StaticLibrary : libmupdfthirdparty.a SharedLibrary : libmupdf.so
This was the answer to the first question. There is also a big step-by-step guide in the android / Readme.txt file.
Now the answer to the second question. In the Android application you can find a test project. There are 3 files:
- MuPDFActivity.java
- MuPDFCore.java
- PixmapView.java
Just copy the last two files to your project. And look at an example in MuPDFActivity.java how you can embed the mupdf layout in your activity. In this file, it is done like this:
PixmapView pixmapView; //... layout = new RelativeLayout(this); //... RelativeLayout.LayoutParams pixmapParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); pixmapParams.addRule(RelativeLayout.ABOVE,100); layout.addView(pixmapView, pixmapParams); setContentView(layout);
Yury Dec 21 '11 at 9:24 a.m. 2011-12-21 09:24
source share