MuPDF App Kit, our mobile PDF SDK for Android, comes with a drop-in Default UI that enables easy PDF document viewing and editing for your applications. The Default UI connects with the native file browser on your Android platforms and accommodates for both tablet and phone layout. Let’s take a look at how easy it is to integrate with your own Android mobile application!
(If you haven't already, you can download the MuPDF App Kit demo here.)
Jump to a section
You will need to use the Gradle build system to include MuPDF in your app.
1. App Kit can be retrieved as pre-built artifacts from a local app/libs
folder relative to your Android project. After downloading the latest version of MuPDF App Kit, copy the 5 aar
files contained in mupdf-test/app/libs
to your own app's app/libs/
folder. Sync your build.gradle
and the App Kit libraries should be ready to go.
The MuPDF library requires Android version 6.0 or newer.
2. Make sure that the minSdkVersion
in your app's build.gradle
is at least 23.
3. To add MuPDF App Kit to your project, reference the following dependencies in your Module
build.gradle
:
PDF documents in App Kit are always rendered inside of a document view instance.
4. Files that will need to instantiate and access the document view should reference the following:
Your Android Activity
should handle the regular Android Activity Lifecycle events and inform any DocumentView
instance of the corresponding Activity events. Additionally Activity interfaces are required to be set up for full App Kit functionality.
5. Include the Default UI activity in your AndroidManifest.xml
as follows:
6. Import the Default UI activity into your application code:
7. Instantiate and start the App Kit DefaultUIActivity
with null data and it will automatically open the Android file browser for you to select a PDF file:
And that’s it! The Default UI will handle the document interactions from here, allowing your Android app users to perform a variety of typical document actions against high fidelity PDFs.
There are a number of file operations available against a document - Save, Save As, Export, Print, Search.
The Default UI supports the creation of annotations on a PDF document, including:
Drawing
Adding Notes
Highlighting Text
This blog post covered the Default UI included with our mobile PDF SDK for Android. To learn more about the full library of features, you can read the MuPDF App Kit documentation here.
More about MuPDF App Kit