AnnotationManager class abstract

Abstract base class for managing annotations in a PDF document.

This class provides a safe way to update annotations without losing attachments or custom data, which was a critical issue with the deprecated updateAnnotation method.

Usage:

final manager = await document.annotationManager;
final properties = await manager.getAnnotationProperties(pageIndex, annotationId);
if (properties != null) {
  final updated = properties.withColor(Colors.red).withOpacity(0.7);
  await manager.saveAnnotationProperties(updated);
}

Constructors

AnnotationManager({required String documentId})

Properties

documentId String
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addAnnotation(Annotation annotation) Future<String>
Adds a new annotation to the document.
exportXFDF([int? pageIndex]) Future<String>
Exports annotations as XFDF format.
getAnnotationProperties(int pageIndex, String annotationId) Future<AnnotationProperties?>
Gets annotation properties for modification. Returns null if the annotation doesn't exist.
getAnnotations(int pageIndex, [AnnotationType type = AnnotationType.all]) Future<List<Annotation>>
Gets all annotations on a specific page.
getUnsavedAnnotations() Future<List<Annotation>>
Gets all annotations that have unsaved changes.
importXFDF(String xfdfString) Future<bool>
Imports annotations from XFDF format.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeAnnotation(int pageIndex, String annotationId) Future<bool>
Removes an annotation from the document.
saveAnnotationProperties(AnnotationProperties properties) Future<bool>
Saves modified annotation properties. Only non-null properties in properties will be updated. All other properties (including attachments and custom data) are preserved.
searchAnnotations(String query, [int? pageIndex]) Future<List<Annotation>>
Searches for annotations containing specific text.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited