Create PDF annotations in our MAUI viewer
Since Nutrient MAUI SDK implements an optimistic user interface (UI), you can easily create annotations directly through the UI.
An annotation can be created using the IAnnotationFactory.CreateAnnotation<TAnnotationType>()
method. The annotation can then be added to a document using IAnnotationManager.AddAnnotation()
. This will return a task that resolves to the created annotation’s ID:
var annotation = _annotationManager.AnnotationFactory.CreateAnnotation<Line>(); await _annotationManager.AddAnnotation(annotation);
Following the optimistic UI approach, the changes will be instantly visible in the UI, but they aren’t persisted until the annotations are saved. This is done by saving them using JavaScript APIs. You can save them to external storage or embed them into a document. They can also be exported to Instant JSON using native APIs or XFDF by bridging JavaScript APIs.