applyPendingRedactions method
Implementation
Future<int> applyPendingRedactions() async {
attach();
final UPdfEdit? edit = _edit;
if (edit == null) return 0;
int removed = 0;
for (int page = 0; page < viewer.pageCount; page++) {
final List<UPdfAnnotationInfo> list = await edit.annotations(page);
final List<Rect> areas = list.where((UPdfAnnotationInfo info) => info.subtype == "Square" && info.color == const Color(0xFF000000)).map((UPdfAnnotationInfo info) => info.rect).toList();
if (areas.isEmpty) continue;
for (final UPdfAnnotationInfo info in list.where((UPdfAnnotationInfo info) => info.subtype == "Square" && info.color == const Color(0xFF000000))) {
await edit.removeAnnotation(page, info.objectNumber);
}
removed += await UPdfRedactor(edit).apply(page, areas);
viewer.invalidatePage(page);
}
notifyListeners();
return removed;
}