Get started integrating Apryse React Native SDK
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.
Android & React-Native PDF library Integration
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.
Prerequisites
Set up development environment for React Native environment
Latest stable version of Android Studio
Have Android NDK (Native Development Kit) installed
Apryse SDK >= 11.0.0
react-native >= 0.60.0
TypeScript >= 3.4.1 (optional; see TypeScript)
Integrate
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:or
Initialize the project by running the following command:
In
MyAppfolder, installreact-native-pdftron. There are two ways to integrate the SDK:
In
MyAppfolder, installreact-native-pdftronby calling:or
Through Apryse's github repo:
In
MyAppfolder, install run the following commands:or
Through Apryse's npm package:
Add the following in your
android/app/build.gradlefile:
In your
android/gradle.propertiesfile, add the following line:
Add the following to your
android/app/src/main/AndroidManifest.xmlfile:
In your
android/app/src/main/java/com/myapp/MainApplication.javafile, changeApplicationtoMultiDexApplication:
TypeScript
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.
All Users
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:
Proper API typings which can be used in tools such as IntelliSense. This offers insight into the data being passed without referring to the API documentation.
Greater type safety and reliability due to the migration of source files from JavaScript to TypeScript.
Updated Add an API guides to offer step-by-step, TypeScript-supported examples on accessing properties, methods, and events. Contributors should be aware that PRs must now be made to the
devbranch (see Contributing).
If you have questions, head to the FAQ's React Native section.
TypeScript Users
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:
TypeScript version 3.4.1+ is recommended. Although compilation still works with lower versions, typings may degrade to
any.Due to the introduction of proper typings to Apryse's APIs, your compiler may now give warnings or errors about your usage of these APIs. In most cases these will not prevent your app from running but it is advised that you address them to take full advantage of TypeScript. It is particularly important to address them if you use TypeScript to emit files and have enabled
noEmitOnErrorin yourtsconfig.json.
Next step
iOS & React-Native PDF library Integration
This guide will help you integrate a free trial of the Apryse SDK into your iOS applications using React Native. Your free trial includes unlimited trial usage and support from solution engineers.
Prerequisites
Set up development environment for React Native environment
Latest stable version of Xcode
Latest stable version of CocoaPods
Apryse SDK >= 11.0.0
react-native >= 0.60.0
TypeScript >= 3.4.1 (optional; see TypeScript)
Integrate
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:or
Initialize the project by running the following command:
In the terminal change the location of the working directly to the directory of the newly created project:
Install
react-native-pdftronby calling. There are two ways to integrate the SDK:
In
MyAppfolder, installreact-native-pdftronby calling:or
Through Apryse's github repo:
In
MyAppfolder, install run the following commands:or
Through Apryse's npm package:
Open
Podfilein theiosfolder, add:
Change working directory to the
iosfolderinstall the pods by running the command:
(Optional) If you need a close button icon, you will need to add the PNG resources to
MyAppas well, i.e.ic_close_black_24px.
TypeScript
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.
All Users
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:
Proper API typings which can be used in tools such as IntelliSense. This offers insight into the data being passed without referring to the API documentation.
Greater type safety and reliability due to the migration of source files from JavaScript to TypeScript.
Updated Add an API guides to offer step-by-step, TypeScript-supported examples on accessing properties, methods, and events. Contributors should be aware that PRs must now be made to the
devbranch (see Contributing).
If you have questions, head to the FAQ's React Native section.
TypeScript Users
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:
TypeScript version 3.4.1+ is recommended. Although compilation still works with lower versions, typings may degrade to
any.Due to the introduction of proper typings to Apryse's APIs, your compiler may now give warnings or errors about your usage of these APIs. In most cases these will not prevent your app from running but it is advised that you address them to take full advantage of TypeScript. It is particularly important to address them if you use TypeScript to emit files and have enabled
noEmitOnErrorin yourtsconfig.json.
Next step
Last updated
Was this helpful?