How to use MuPDF with your EXISTING Eclipse project

How to use MuPDF with your EXISTING Eclipse project:


1. Copy the 'jni' folder from the <mupdf>/android folder into your existing Eclipse project.
2. Copy the <mupdf>/thirdparty folder into the 'jni' folder in your project.
3. Copy the <mupdf>/cbz folder into the 'jni' folder in your project.
4. Copy the <mupdf>/draw folder into the 'jni' folder in your project.
5. Copy the <mupdf>/fitz folder into the 'jni' folder in your project.
6. Copy the <mupdf>/generated folder into the 'jni' folder in your project.
7. Copy the <mupdf>/pdf folder into the 'jni' folder in your project.
8. Copy the <mupdf>/scripts folder into the 'jni' folder in your project.
8. Copy the <mupdf>/xps folder into the 'jni' folder in your project.
9. Open 'Android.mk' inside the 'jni' folder.
10. Change

MUPDF_ROOT := ..

to

MUPDF_ROOT := $(TOP_LOCAL_PATH)

11. Save 'Android.mk'.
12. Open 'Core.mk' inside the 'jni' folder.
13. Change

MY_ROOT := ../..

to

MY_ROOT := $(LOCAL_PATH)


14. Change all the

..

in LOCAL_C_INCLUDES to

$(LOCAL_PATH)

14. Save 'Core.mk'.
15. Open 'ThirdParty.mk' inside the 'jni' folder.
16. Change

MY_ROOT := ../..

to

MY_ROOT := $(LOCAL_PATH)

17. Change all the

..

in LOCAL_C_INCLUDES to

$(LOCAL_PATH)

18. Save 'ThirdParty.mk'.
22. Now execute 'ndk-build' in your project's 'jni' directory.
23. Copy everything in the <mupdf>/android/src folder into the 'src' folder in your project.
24. Copy everything in the <mupdf>/android/res/drawable folder into the 'res/drawable' folder in your project.
25. Copy everything in the <mupdf>/android/res/drawable-ldpi folder into the 'res/drawable-ldpi' folder in your project.
26. Copy everything in the <mupdf>/android/res/drawable-mdpi folder into the 'res/drawable-mdpi' folder in your project.
27. Copy everything in the <mupdf>/android/res/layout folder EXCEPT main.xml (because if you are copying into an existing project then you should already have your own main.xml or equivalent) into the 'res/layout' folder in your project.
28. Copy everything in the <mupdf>/android/res/values folder into the 'res/values' folder in your project. If you already have a 'strings.xml' in your existing project, copy everything in between the '<resources>' tags in your <mupdf>/android/res/values/strings.xml into your project's strings.xml (paste between the '<resources>' tags). Similarly with the 'colors.xml',  if you already have a 'colors.xml' in your existing project, copy everything in between the '<resources>' tags in your <mupdf>/android/res/values/strings.xml into your project's strings.xml (paste between the '<resources>' tags).
29. Open the 'AndroidManifest.xml' in project.
30. In between the '<application>' tags paste this:

        <activity android:name="com.artifex.mupdf.MuPDFActivity"
                  android:label="@string/app_name"
 android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="application/vnd.ms-xpsdocument"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="application/pdf"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="application/x-cbz"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="file"/>
                <data android:mimeType="*/*"/>
                <data android:pathPattern=".*\\.xps"/>
                <data android:host="*"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="file"/>
                <data android:mimeType="*/*"/>
                <data android:pathPattern=".*\\.pdf"/>
                <data android:host="*"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="file"/>
                <data android:mimeType="*/*"/>
                <data android:pathPattern=".*\\.cbz"/>
                <data android:host="*"/>
            </intent-filter>
        </activity>
        <activity android:name="OutlineActivity"
                  android:label="@string/outline_title">
</activity>

(taken from the AndroidManifest.xml inside the <mupdf>/android folder).

31. MuPDF in now in your existing Eclipse project. To use it, call up com.artifex.mupdf.ChoosePDFActivity.class in your application. This is the main class for MuPDF.


Learn More :