importAnnotation method
Import the annotation data from UTF8 bytes with the specific PdfAnnotationDataFormat.
//Load an existing PDF document.
PdfDocument document =
PdfDocument(inputBytes: File('input.pdf').readAsBytesSync());
//Import annotations in specific PdfAnnotationDataFormat format.
document.importAnnotation(
File('input.fdf').readAsBytesSync(), PdfAnnotationDataFormat.fdf);
//Save the document.
File('output.pdf').writeAsBytesSync(await document.save());
//Dispose the document.
document.dispose();
Implementation
void importAnnotation(List<int> data, PdfAnnotationDataFormat format) {
if (format == PdfAnnotationDataFormat.xfdf) {
_helper.importXfdf(data);
} else if (format == PdfAnnotationDataFormat.fdf) {
_helper.importFdf(data);
} else if (format == PdfAnnotationDataFormat.json) {
_helper.importJson(data);
}
}