Some test text!
Cross-platform / Guides
Welcome to Apryse. Apryse SDK can be integrated with Flutter for both Android and iOS.
This guide will help you integrate a free trial of the Apryse SDK into your Android applications using Flutter. Your free trial includes unlimited trial usage and support from solution engineers.
For simplicity, the following guide is based on a boilerplate Flutter app and uses Git Diff syntax to represent lines that have been added to or removed from the app. Please follow these Flutter get started guides to install, set up an editor, and create a Flutter Project if you are a first time Flutter developer
Initialize the project by running the command:
flutter create myapp
Add the following dependency to your Flutter project in myapp/pubspec.yaml
:
If you want to use our null safe package from pub.dev:
```diff
//@data {"gitDiff":true}// dependencies: flutter: sdk: flutter
If you want to use our null safe package from GitHub:
dependencies:
flutter:
sdk: flutter
+ pdftron_flutter:
+ git:
+ url: git://github.com/ApryseSDK/pdftron-flutter.git
Navigate to your myapp
folder:
cd myapp
and run the following command to get the required packages:
flutter packages get
Now add the following items in your myapp/android/app/build.gradle
file:
defaultConfig {
applicationId "com.example.myapp"
- minSdkVersion flutter.minSdkVersion
+ minSdkVersion 21
+ multiDexEnabled true
+ manifestPlaceholders += [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
In your myapp/android/app/src/main/AndroidManifest.xml
file, add the following lines:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<!-- 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" />
<!-- Enable usesCleartextTraffic in application attributes if you are working with HTTP files. If you are only working with HTTPS files, this is not required.-->
<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:name=".MainActivity"
android:exported="true"
...
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as the Android process has started. This theme is visible to the user while the Flutter UI initializes. After that, this theme continues to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
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=
If you are using the DocumentView
widget, change the parent class of your MainActivity
file (either Kotlin or Java) to FlutterFragmentActivity
.
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity : FlutterFragmentActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales