Embed annotations in a PDF file on Flutter

Nutrient Flutter SDK allows you to create a new document with embedded annotations using the processAnnotations(String type, String processingMode, String destinationPath) function.

Parameters

type is the annotation type parameter that specifies which annotation types Nutrient should process. See the list of all supported annotation types. To process all annotations (including forms), you need to set the value for the annotation type parameter to all or null.

processingMode is a string that specifies how Nutrient should include annotations in the resulting document. For embedding annotations while still allowing them to be modified, the mode should be set to embed. See our annotation flattening guide for a description of the other available processing modes.

destinationPath is a string that specifies the path where the resultant processed file will be stored. By default, it’ll be stored under the document directory.

Warning

Make sure you save all annotations before processing the document. For more details, refer to our guide showing how to manually save annotations in a document.

Usage

Here’s how the function call for embedding all annotations into the PDF, which will be saved to PDFs/export.pdf, would look:

// First open a PDF file using `present()`.
await Pspdfkit.processAnnotations('all', 'embed', 'PDFs/export.pdf');