Integrate MuPDF Reader in an app
I don't know how to do this in Windows using cygwin, because I'm using Ubuntu for the development. But I think the procedure should be the same.
- Download the file mupdf-0.9-source.tar.gz here:
http://code.google.com/p/mupdf/downloads/list?q=source - Download the file mupdf-thirdparty.zip
- Extract the sources. By default they will be extracted to the folder: mupdf-0.9/
- Extract the file mupdf-thirdparty.zip into the folder mupdf-0.9/
- Build the project mupdf-0.9 (For windows you should use VS as it is declared in the readme files)
- Then go to the folder mupdf-0.9/android/
- Run ndk-build
- You can get 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: redefinition of typedef....)
However, you can simply comment the lines of the definition of types in the file /thirdparty/jbig2dec/os_types.h
After that you will receive two libraries: one static and one shared for your android application.
StaticLibrary : libmupdfthirdparty.a
SharedLibrary : libmupdf.so
This was the answer on the first question. Also there is a great step-by-step guide in the android/Readme.txt file.
Now the answer on the second question.
In the application for android you can find test project. There are 3 files:
- MuPDFActivity.java
- MuPDFCore.java
- PixmapView.java
Simply copy the last two files in your project. And see an example in MuPDFActivity.java how you can embed mupdf layout in your activity. In this file it is done like:
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);
How to Integrate Mupdf in android studio step by step?
Here is a link that shows one way to integrate mupdf to android:
MuPDF Android Integration
It's written by Şahin Koç.
Hope this helps.
Pdf Viewer using mupdf library
- Download latest android NDK
- Install CYGWIN
- Download complete source code of MUPDF (with thirty part tool)
- Download ANT build for windows
- set all needed path (JAVA_HOME,ANT_HOME)
- go to MuPDF directory
- Run MAKE command
- Then Import project in android from c:\mupdf\android
- Run your android project.
Don't forget to keep at least one pdf in Downloads folder
also follow all the step given in mupdf
Want to use mupdf for android app in our project
Its open source code under the Affero General Public Licence. If your application or usage conforms to the AGPL then you can use the library freely.
If it does not (eg you intend to sell your application, or you intend to use portions of the source without making your own source open source under the AGPL) then you must seek a commercial licence. Artifex has a range of different licencing options, including one specifically designed for Android/iPhone app developers.
If you feel you need a commercial licence, or want to discuss it, then you should contact sales@artifex.com.
Related Topics
Android Get Free Size of Internal/External Memory
Determine If Android App Is Being Used For the First Time
Android Camera Intent: How to Get Full Sized Photo
Separate Back Stack For Each Tab in Android Using Fragments
Fileprovider - Illegalargumentexception: Failed to Find Configured Root
Android Deprecated Apache Module (Httpclient, Httpresponse, etc.)
Perform a Task on Uninstall in Android
Using Intent in an Android Application to Show Another Activity
How to Crop Circular Area from Bitmap in Android
How to Add a Jar in External Libraries in Android Studio
Checkbox in Recyclerview Keeps on Checking Different Items
Viewpager.Setoffscreenpagelimit(0) Doesn't Work as Expected
How to Detect When an Android Application Is Running in the Emulator
How to Display a List View in an Android Alert Dialog
API Key for Gcm Is Suddenly Invalid? Unauthorized (401) Error
...Have You Declared This Activity in Your Androidmanifest.Xml