addAnnotations method

Future<bool> addAnnotations(
  1. List<CPDFAnnotation> annotations
)

Adds annotations to the document.

example:

List<CPDFAnnotation> annotations = [
    CPDFNoteAnnotation(
          page: 1,
          title: 'ComPDFKit-Flutter',
          content: 'This is Note Annotation',
          uuid: 'note-annotation-1',
          rect: const CPDFRectF(left: 260, top: 700, right: 300, bottom: 740),
          color: Colors.green,
          alpha: 128)];
await document.addAnnotations(annotations);

Implementation

Future<bool> addAnnotations(List<CPDFAnnotation> annotations) async {
  List<Map<String, dynamic>> annotationsData =
      annotations.map((e) => e.toJson()).toList();
  return await _channel
      .invokeMethod('add_annotations', {'annotations': annotationsData});
}