Some test text!
Android / Guides
Welcome to Apryse. This guide will help you integrate a free trial of the Apryse React Native SDK into your React Native Project. Your free trial includes unlimited trial usage and support from solution engineers.
This guide will help you integrate a free trial of the Apryse 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
For the expo setup of the project please refer to this blog post.
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.
If you are using yarn, run the command to install react-native cli:
yarn global add react-native-cli
or
npm install -g react-native-cli
Initialize the project by running the following command:
react-native init MyApp
In MyApp
folder, install react-native-pdftron
. There are two ways to integrate the SDK:
In MyApp
folder, install react-native-pdftron
by calling:
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
or
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
npm install
In MyApp
folder, install run the following commands:
yarn add @pdftron/react-native-pdf
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
or
npm install @pdftron/react-native-pdf
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
npm install
Add the following in your android/app/build.gradle
file:
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.reactnativesample"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
+ multiDexEnabled true
+ manifestPlaceholders = [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
}
...
}
...
dependencies {
+ implementation "androidx.multidex:multidex:2.0.1"
...
}
In your android/gradle.properties
file, add the following line:
# Add the PDFTRON_LICENSE_KEY variable here.
# For trial purposes leave it blank.
# For production add a valid commercial license key.
PDFTRON_LICENSE_KEY=
Add the following to your android/app/src/main/AndroidManifest.xml
file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp">
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required if you want to record audio annotations -->
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
...
+ android:largeHeap="true"
+ android:usesCleartextTraffic="false">
<!-- 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}"/>
<activity
...
- android:windowSoftInputMode="adjustResize"
+ android:windowSoftInputMode="adjustPan"
+ android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
In your android/app/src/main/java/com/myapp/MainApplication.java
file, change Application
to MultiDexApplication
:
- import android.app.Application;
+ import androidx.multidex.MultiDexApplication;
- public class MainApplication extends Application implements ReactApplication {
+ public class MainApplication extends MultiDexApplication implements ReactApplication {
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.Apryse React Native introduced support for TypeScript in version 3.0.0. This update mainly benefits those who already use TypeScript in their applications. It also provides certain benefits to all customers, including those who use JavaScript without TypeScript.
To get access to TypeScript support, simply update your Apryse React Native dependency to version 3.0.0 or higher.
For non-TypeScript users, updating your Apryse React Native dependency to version 3.0.0 or higher will not automatically install TypeScript itself, and you can continue to use the library as before (without TypeScript support). If you currently do not use TypeScript itself in your project and would like to, see Adding TypeScript to an Existing Project.
Regardless of whether you use TypeScript, the following benefits are available:
dev
branch (see Contributing).If you have questions, head to the FAQ's React Native section .
If you are an existing TypeScript user, then the custom typings will be available to you simply by updating your Apryse React Native dependency to version 3.0.0 or higher.
Note:
any
.noEmitOnError
in your tsconfig.json
.Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales