setAnnotationMode method

Future<void> setAnnotationMode(
  1. CPDFAnnotationType type
)

Used to add a specified annotation type when touching the page in annotation mode This method is only available in CPDFViewMode.annotations mode. Example:

await controller.setAnnotationMode(CPDFAnnotationType.note);

Throws an exception if called in a mode other than CPDFViewMode.annotations.

Implementation

Future<void> setAnnotationMode(CPDFAnnotationType type) async {
  var viewMode = await getPreviewMode();
  if(viewMode != CPDFViewMode.annotations) {
    throw Exception(
        'setAnnotationMode is only available in CPDFViewMode.annotations mode, current mode is $viewMode');
  }
  await _channel.invokeMethod('set_annotation_mode', type.name);
}