Events and Notifications

PSPDFKit for Flutter allows you to listen to various events that occur when the end user interacts with PSPDFKit.

The following table lists the events supported by PSPDFKit for Flutter.

Event Description
flutterPdfActivityOnPause Android only. Called when the PDF activity is paused.
pdfViewControllerWillDismiss iOS only. Called right before the dismissal of the PDF view controller.
pdfViewControllerDidDismiss iOS only. Called right after the dismissal of the PDF view controller.

Implementing a Callback Method

The example below shows how to implement a callback to get notified when the PDF activity is paused or when the PDF view controller is about to be dismissed.

// First implement the callback methods:

void flutterPdfActivityOnPauseHandler() {

void pdfViewControllerWillDismissHandler() {

void pdfViewControllerDidDismissHandler() {

// Next, register these callbacks with `Pspdfkit` once. This can be done in the `build` method of your widget.
Pspdfkit.flutterPdfActivityOnPause = () => flutterPdfActivityOnPauseHandler();
Pspdfkit.pdfViewControllerWillDismiss = () => pdfViewControllerWillDismissHandler();
Pspdfkit.pdfViewControllerDidDismiss = () => pdfViewControllerDidDismissHandler();

Now whenever any of these events happen, the corresponding method will trigger and print the relevant text.

We use cookies to improve your experience and for marketing. Learn more in our privacy policy.