Edit PDF annotations in MAUI
In addition to providing an API for creating annotations, we also offer an API for updating those annotations. To update annotations, you can use the IAnnotationManager.UpdateAnnotation()
method:
var annotations = await _annotationManager.GetAnnotationsOnPageAsync(0); var annotationToUpdate = annotations[0]; annotationToUpdate.ShouldRender = !annotationToUpdate.ShouldRender; await _annotationManager.UpdateAnnotation(annotationToUpdate);
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.