Embed annotations in a PDF file on Flutter
Nutrient Flutter SDK enables you to create a new document with embedded annotations using the static Nutrient.processAnnotations()(opens in a new tab) operation.
Parameters
Use these parameters to define which annotations Nutrient processes and where it stores the output file:
typespecifies whichAnnotationType(opens in a new tab) Nutrient should process. For the complete list, refer to the supported annotation types guide. To process all annotations, including forms, useAnnotationType.all.modeis theAnnotationProcessingMode(opens in a new tab) that specifies how Nutrient should include annotations in the resulting document. To embed annotations while users can still modify them, useAnnotationProcessingMode.embed. For the other available processing modes, refer to the annotation flattening guide.sourcePathis the path of the document to process.destinationPathspecifies where Nutrient stores the processed file.
Save all annotations before processing the document. For more details, refer to the guide on manually saving.
Usage
The following example embeds all annotations into the PDF and saves the output to PDFs/export.pdf:
await Nutrient.processAnnotations( sourcePath: 'PDFs/document.pdf', type: AnnotationType.all, mode: AnnotationProcessingMode.embed, destinationPath: 'PDFs/export.pdf',);