Supported document save options in Flutter

Nutrient Flutter SDK version 3.10 introduces DocumentSaveOptions to provide more control over how documents are saved. This feature allows you to customize document properties during the save process. It’s currently only available with the PdfDocument.exportPdf() method, but it’ll be available with other save methods in future releases.

The following save options are available:

  • flatten, which will visually embed annotations and form fields in a document and remove them from the document’s data.

  • incremental, which will force a document to be incrementally saved if true.

  • excludeAnnotations, which will exclude annotations from an exported document.

  • saveForPrinting, which will exclude annotations that have the noPrint flag set to true from an exported document.

  • permissions, which protects a PDF with a password and sets the permissions for the document.

  • outputFormat, which allows you to export a PDF in PDF/A format.

  • userPassword, which sets the user password for a document.

  • ownerPassword, which sets the owner password for a document.

Here’s an example of how to export a PDF document with save options:

pdfDocument.exportPdf(options: DocumentSaveOptions(
  userPassword: 'userPassword',
  ownerPassword: 'ownerPassword',
  flatten: true,
  incremental: true,
  excludeAnnotations: true,
  saveForPrinting: true,
  permissions: [DocumentPermission.print, DocumentPermission.modifications]
)).then((data) {
  /// Save the data to a file or upload to a remote server.
  return data;
});

For more details about how to save a document using Nutrient Flutter SDK, try our Catalog example project.