Skip to Content
NexPDF

Installation

Add the NexPDF Flutter plugin to an app and set up the engine on iOS, Android and desktop.

English

Add the package

nexpdf_flutter is not on pub.dev. Add it from its Git repository:

pubspec.yaml
dependencies:
  nexpdf_flutter:
    git:
      url: https://github.com/nexdevit/nexpdf-flutter
      ref: v1.1.0
flutter pub get

The v1.1.0 release has the engine binaries the platforms below need: NexPdfCore.xcframework.zip, nexpdf-android-1.1.0-maven.zip and nexpdf-ffi-1.1.0-windows-x64.zip.

Set up each platform

The plugin depends on the NexPdfUI pod of the Swift SDK. Download the nexpdf-swift source and NexPdfCore.xcframework.zip from the nexpdf-swift v1.1.0 release, put the source in your project as nexpdf-swift/, unzip the xcframework into it, and add both pods to the Runner target in ios/Podfile:

ios/Podfile
platform :ios, '15.0'

target 'Runner' do
  # ... the lines Flutter generated ...
  pod 'NexPdf',   :path => '../nexpdf-swift'
  pod 'NexPdfUI', :path => '../nexpdf-swift'
end
cd ios && pod install

On iOS the engine is linked statically into the app, and the Dart API finds it in the process.

Check the installation

import 'package:nexpdf_flutter/nexpdf_flutter.dart';

final sdk = NexPdfFlutter();   // throws if the engine library cannot be loaded
print('license platform: ${NexPdfFlutter.platform}');

Bundle the license

Add the license file as a Flutter asset and activate it at start-up, as described in License:

pubspec.yaml
flutter:
  assets:
    - assets/nexpdf_license.xml

On this page