Quick Start Guide#

MuPDF App Kit libraries enable quick and easy PDF document viewing and editing for Android and iOS platforms.

This guide demonstrates how our Drop-in UI solution allows you to get up and running with minimal coding effort.

_images/guide-illustration.svg

Note

The Drop-in UI connects with the native file browser on your Android and iOS platforms for ease of integration and to enable the best possible document management experience.

Setup & integration#

Android#

  1. Embed the App Kit libraries into your project folder:

_images/android-libs.png
  1. Set the minimum Android SDK level in your Gradle file:

android {
    defaultConfig {
        minSdkVersion 23
        ...
    }
    ...
}
  1. Reference the following dependencies in your Gradle file:

dependencies {
    ...
    // Dependency on view binding
    implementation 'androidx.databinding:viewbinding:7.1.2'
    // Dependency on navigation fragments
    implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
    implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'

    // Dependency on local binaries
    implementation fileTree(dir: 'libs', include: ['*.aar'])
}
  1. Include the default UI activity in your AndroidManifest.xml as follows:

<activity android:name="com.artifex.sonui.phoenix.DefaultUIActivity"
         android:exported="true"
         android:configChanges="orientation|keyboard|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode"
         android:screenOrientation="fullSensor"
         android:theme="@style/sodk_editor_mui_theme">
  1. Import the required modules into your application code:

import com.artifex.sonui.phoenix.DefaultUIActivity
import com.artifex.solib.ArDkLib
import com.artifex.solib.ConfigOptions
  1. Instantiate the App Kit DefaultUIActivity class with data representing your file URI and start the activity:

val defaultUI = Intent(this, DefaultUIActivity::class.java).apply {
    this.action = Intent.ACTION_VIEW
    this.data = uri
}

// Setup the document viewing configuration options
val appCfgOpts = ConfigOptions()
ArDkLib.setAppConfigOptions(appCfgOpts)

startActivity(defaultUI)

iOS#

  1. Embed the App Kit frameworks into your Xcode project:

_images/xcode-frameworks.png
  1. Import the frameworks into your application code:

import mupdfdk
import mupdf_default_ui
  1. Instantiate the App Kit DefaultUIViewController with your document URL and push it to your navigation controller:

DefaultUIViewController.viewController(url: url) { vc in
   if let vc = vc {
       vc.modalPresentationStyle = .fullScreen
       self.navigationController?.pushViewController(vc, animated: true)
   }
}

Customization#

If you wish to build your own UI for file viewing then you should integrate your application code with the App Kit API.


This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of that license. Refer to licensing information at artifex.com or contact Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, CA 94129, USA, for further information.Discord logo