Flutter Widget: PspdfkitWidget

PspdfkitWidget is a Flutter widget that allows you to integrate PSPDFKit directly into your Flutter app and modify and adjust the layout of the PDF widget to your liking. To read more about PspdfkitWidget, please check out the Dart Components Explained section of our How to Bridge Native iOS Code to Flutter blog post.

The example below shows two PspdfkitWidget instances side by side:

final document1 = ... // Copy the document from assets to the temporary directory.
final document2 = ... // Copy the document from assets to the temporary directory.

if (Theme.of(context).platform == TargetPlatform.iOS) {
    await Navigator.of(context).push<dynamic>(CupertinoPageRoute<dynamic>(
        builder: (_) => CupertinoPageScaffold(
            navigationBar: CupertinoNavigationBar(),
            child: SafeArea(
                bottom: false,
                child: Row(children: <Widget>[
                    Expanded(
                        child: PspdfkitWidget(documentPath: document1.path)),
                    Expanded(
                        child: PspdfkitWidget(documentPath: document2.path))
                ])))));
} else {
    // `PspdfkitWidget` is only supported in iOS at the moment.
    // Support for Android is coming soon.
}

Here’s how it looks in action:

ℹ️ Note: PspdfkitWidget only supports the iOS platform at the moment. Support for Android is coming soon.

PSPDFKit for Flutter also allows you to present a modal PDF view using the present() method. Here’s how you can do that:

// First copy the document from assets to the temporary directory.
await Pspdfkit.present(document.path);