Want more features on Pastebin? Sign Up, it's FREE!
Guest

How to use MuPDF with your EXISTING Eclipse project

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 5.44 KB  |  views: 3,934  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to use MuPDF with your EXISTING Eclipse project:
  2.  
  3. 1. Copy the 'jni' folder from the <mupdf>/android folder into your existing Eclipse project.
  4. 2. Copy the <mupdf>/thirdparty folder into the 'jni' folder in your project.
  5. 3. Copy the <mupdf>/cbz folder into the 'jni' folder in your project.
  6. 4. Copy the <mupdf>/draw folder into the 'jni' folder in your project.
  7. 5. Copy the <mupdf>/fitz folder into the 'jni' folder in your project.
  8. 6. Copy the <mupdf>/generated folder into the 'jni' folder in your project.
  9. 7. Copy the <mupdf>/pdf folder into the 'jni' folder in your project.
  10. 8. Copy the <mupdf>/scripts folder into the 'jni' folder in your project.
  11. 8. Copy the <mupdf>/xps folder into the 'jni' folder in your project.
  12. 9. Open 'Android.mk' inside the 'jni' folder.
  13. 10. Change
  14.  
  15. MUPDF_ROOT := ..
  16.  
  17. to
  18.  
  19. MUPDF_ROOT := $(TOP_LOCAL_PATH)
  20.  
  21. 11. Save 'Android.mk'.
  22. 12. Open 'Core.mk' inside the 'jni' folder.
  23. 13. Change
  24.  
  25. MY_ROOT := ../..
  26.  
  27. to  
  28.  
  29. MY_ROOT := $(LOCAL_PATH)
  30.  
  31.  
  32. 14. Change all the
  33.  
  34. ..
  35.  
  36. in LOCAL_C_INCLUDES to
  37.  
  38. $(LOCAL_PATH)
  39.  
  40. 14. Save 'Core.mk'.
  41. 15. Open 'ThirdParty.mk' inside the 'jni' folder.
  42. 16. Change
  43.  
  44. MY_ROOT := ../..
  45.  
  46. to
  47.  
  48. MY_ROOT := $(LOCAL_PATH)
  49.  
  50. 17. Change all the
  51.  
  52. ..
  53.  
  54. in LOCAL_C_INCLUDES to
  55.  
  56. $(LOCAL_PATH)
  57.  
  58. 18. Save 'ThirdParty.mk'.
  59. 22. Now execute 'ndk-build' in your project's 'jni' directory.
  60. 23. Copy everything in the <mupdf>/android/src folder into the 'src' folder in your project.
  61. 24. Copy everything in the <mupdf>/android/res/drawable folder into the 'res/drawable' folder in your project.
  62. 25. Copy everything in the <mupdf>/android/res/drawable-ldpi folder into the 'res/drawable-ldpi' folder in your project.
  63. 26. Copy everything in the <mupdf>/android/res/drawable-mdpi folder into the 'res/drawable-mdpi' folder in your project.
  64. 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.
  65. 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).
  66. 29. Open the 'AndroidManifest.xml' in project.
  67. 30. In between the '<application>' tags paste this:
  68.  
  69.         <activity android:name="com.artifex.mupdf.MuPDFActivity"
  70.                   android:label="@string/app_name"
  71.                   android:theme="@android:style/Theme.NoTitleBar">
  72.             <intent-filter>
  73.                 <action android:name="android.intent.action.VIEW"/>
  74.                 <category android:name="android.intent.category.DEFAULT"/>
  75.                 <data android:mimeType="application/vnd.ms-xpsdocument"/>
  76.             </intent-filter>
  77.             <intent-filter>
  78.                 <action android:name="android.intent.action.VIEW"/>
  79.                 <category android:name="android.intent.category.DEFAULT"/>
  80.                 <data android:mimeType="application/pdf"/>
  81.             </intent-filter>
  82.             <intent-filter>
  83.                 <action android:name="android.intent.action.VIEW"/>
  84.                 <category android:name="android.intent.category.DEFAULT"/>
  85.                 <data android:mimeType="application/x-cbz"/>
  86.             </intent-filter>
  87.             <intent-filter>
  88.                 <action android:name="android.intent.action.VIEW"/>
  89.                 <category android:name="android.intent.category.DEFAULT"/>
  90.                 <category android:name="android.intent.category.BROWSABLE"/>
  91.                 <data android:scheme="file"/>
  92.                 <data android:mimeType="*/*"/>
  93.                 <data android:pathPattern=".*\\.xps"/>
  94.                 <data android:host="*"/>
  95.             </intent-filter>
  96.             <intent-filter>
  97.                 <action android:name="android.intent.action.VIEW"/>
  98.                 <category android:name="android.intent.category.DEFAULT"/>
  99.                 <category android:name="android.intent.category.BROWSABLE"/>
  100.                 <data android:scheme="file"/>
  101.                 <data android:mimeType="*/*"/>
  102.                 <data android:pathPattern=".*\\.pdf"/>
  103.                 <data android:host="*"/>
  104.             </intent-filter>
  105.             <intent-filter>
  106.                 <action android:name="android.intent.action.VIEW"/>
  107.                 <category android:name="android.intent.category.DEFAULT"/>
  108.                 <category android:name="android.intent.category.BROWSABLE"/>
  109.                 <data android:scheme="file"/>
  110.                 <data android:mimeType="*/*"/>
  111.                 <data android:pathPattern=".*\\.cbz"/>
  112.                 <data android:host="*"/>
  113.             </intent-filter>
  114.         </activity>
  115.         <activity android:name="OutlineActivity"
  116.                   android:label="@string/outline_title">
  117.         </activity>
  118.  
  119. (taken from the AndroidManifest.xml inside the <mupdf>/android folder).
  120.  
  121. 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.
clone this paste RAW Paste Data