Some test text!


Integrate Android PDF Library using React Native

See here for the get started guide for using the PDFTron React Native SDK on iOS.

This guide will help you integrate a free trial of the PDFTron SDK into your Android applications using React Native. Your free trial includes unlimited trial usage and support from solution engineers.

Get the React Native source code


  • PDFTron SDK >= 9.1.0
  • react-native >= 0.60.0
  • npm or yarn
No trial license key required.
The trial of PDFTron SDK works without a license key. A commercial license key is required for use in a production environment. Please fill out our licensing form if you do not have a valid license key.
Keep your commercial license key confidential.
License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).


For simplicity the following guide is based on a boilerplate react native app for react-native init MyApp with git diff syntax for adding and removing lines from the boilerplate app.

  1. If using yarn, do: yarn global add react-native-cli

  2. First, follow the official getting started guide on setting up the React Native environment, setting up the iOS environment, setting up the Android environment, and creating a React Native project, the following steps will assume your app is created through react-native init MyApp.

  3. In MyApp folder, install react-native-pdftron by calling:

//@data {"ga":4003205466}// yarn add github:PDFTron/pdftron-react-native yarn add @react-native-community/cli --dev yarn add @react-native-community/cli-platform-android --dev yarn add @react-native-community/cli-platform-ios --dev yarn install orshell //@data {"ga":6477418060}// npm install github:PDFTron/pdftron-react-native --save npm install @react-native-community/cli --save-dev npm install @react-native-community/cli-platform-android --save-dev npm install @react-native-community/cli-platform-ios --save-dev ```

  1. Add the following in your android/app/build.gradle file:

    android {
        compileSdkVersion rootProject.ext.compileSdkVersion
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        defaultConfig {
            applicationId "com.reactnativesample"
            minSdkVersion rootProject.ext.minSdkVersion
            targetSdkVersion rootProject.ext.targetSdkVersion
            versionCode 1
            versionName "1.0"
    +       multiDexEnabled true
    +       manifestPlaceHolders = [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
    dependencies {
    +   implementation "androidx.multidex:multidex:2.0.1"
  2. Add the following to your android/app/src/main/AndroidManifest.xml file:

    <manifest xmlns:android=""
            <uses-permission android:name="android.permission.INTERNET" />
            <!-- Required to read and write documents from device storage -->
    +	    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
            <!-- Required if you want to record audio annotations -->
    +	    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    +   android:largeHeap="true"
    +   android:usesCleartextTraffic="true">
        <!-- Add license key in meta-data tag here. This should be inside the application tag. -->
    +       <meta-data
    +           android:name="pdftron_license_key"
    +           android:value="${pdftronLicenseKey}"/>
    -     android:windowSoftInputMode="adjustResize"
    +     android:windowSoftInputMode="adjustPan"
    +     android:theme="@style/PDFTronAppTheme">
              <action android:name="android.intent.action.MAIN" />
              <category android:name="android.intent.category.LAUNCHER" />
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
  3. In your android/app/src/main/java/com/myapp/ file, change Application to MultiDexApplication:

    - import;
    + import androidx.multidex.MultiDexApplication;
    - public class MainApplication extends Application implements ReactApplication {
    + public class MainApplication extends MultiDexApplication implements ReactApplication {
If your app is targeting Android SDK version 28 or higher, please make sure the android:usesCleartextTraffic="true" attribute is set in your application tag to open HTTP files in the viewer. If you are only working with HTTPS files, this is not required.

Next step

View a document

Get the answers you need: Support