PDFTron Flutter Wrapper
- A valid evaluation or commercial license key. If you do not have a license key, please contact sales for a commercial license key or click here to get an evaluation key.
- PDFTron gradle credentials that comes with your license key (Android)
- PDFTron SDK >= 6.9.0
- Flutter >= 1.0.0
Preview
Android
iOS
Installation
The complete installation and API guides can be found at https://www.pdftron.com/documentation/android/guides/flutter
Android
- First follow the Flutter getting started guides to install, set up an editor, and create a Flutter Project. The rest of this guide assumes your project is created by running
flutter create myapp. - Add the following dependency to your Flutter project in
myapp/pubspec.yaml: - Now add the following items in your
myapp/android/app/build.gradlefile: - In your
myapp\android\app\src\main\AndroidManifest.xmlfile, add the following lines to the<application>tag:Additionally, add the required permissions for your app in the<manifest>tag: - Add your PDFTron credentials in to the
myapp/android/gradle.propertiesfile. - Replace
lib/main.dartwith what is shown here - Check that your Android device is running by running the command
flutter devices. If none are available, follow the device set up instructions in the Install guides for your platform. - Run the app with the command
flutter run.
iOS
- First, follow the official getting started guide on installation, setting up an editor, and create a Flutter project, the following steps will assume your app is created through
flutter create myapp - Open
myappfolder in a text editor. Then openmyapp/pubspec.yamlfile, add: - Run
flutter packages get - Open
myapp/ios/Podfile, add: - Run
flutter build ios --no-codesignto ensure integration process is sucessful - Replace
lib/main.dartwith what is shown here - Run
flutter emulators --launch apple_ios_simulator - Run
flutter run
Usage
Open
lib/main.dart, replace the entire file with the following:
Replace
your_pdftron_license_key string with your license keyAPIs
PdftronFlutter.version
Obtain PDFTron SDK version
PdftronFlutter.initialize(String)
Initializes PDFTron SDK
PdftronFlutter.openDocument(String)
Opens a document in the viewer.


