Save as PDFs in Flutter

It’s not uncommon for customers to want a setup where a document is read-only but users can still edit it and then use the Save As functionality to save the modified document to a new location. PSPDFKit supports saving documents with the Save As functionality.

After displaying a document on Flutter using either PspdfkitWidget or Pspdfkit.present(), Save As can be implemented by following these steps:

  • Ensuring disableAutosave is set to true in the configuration.

  • Calling the processAnnotations API on either PspdfkitWidgetController or the Pspdfkit plugin when a custom Flutter Button widget is pressed.

PspdfkitWidget and PspdfkitWidgetController

The code for this on Dart looks something like this:

Widget build(BuildContext context) {
    // ...
 return Scaffold(
        // ...
          body: Column(children: [
                      child: PspdfkitWidget(
                        document: documentPath,
                        configuration: configuration,
                        onCreated: onPlatformViewCreated),
                        child: ElevatedButton(
                          onPressed: () async {
                            // Ensure that the path for the new document is a writable path.
                            // You can use a package like to allow users to select the directory and name of the file to save.
                            final newDocumentPath = await getExportPath(
                            await pspdfkitWidgetController.processAnnotations(
                                'all', 'embed', newDocumentPath);

                                'Document has been saved to $newDocumentPath');
                          child: const Text('Save Document As'))
// ...

// ...

// This method is part of the custom widget's class.
  Future<void> onPlatformViewCreated(controller) async {
    pspdfkitWidgetController = controller;

Save As is currently only available on iOS. Support for Save As on Android is coming soon.