applyRedaction method
Permanently applies a single redaction annotation.
The annotation must have been read from CPDFPage.getAnnotations so its native CPDFAnnotation.uuid can be resolved. A successfully applied annotation is removed and the supplied object must not be reused.
Throws ArgumentError when the annotation does not identify a native redaction. Native application failures are reported as PlatformException.
Implementation
Future<void> applyRedaction(CPDFRedactAnnotation annotation) async {
//TODO: iOS 端应用密文存在问题 redmine(https://pms.kdan.cc/issues/31668)
if (annotation.uuid.isEmpty) {
throw ArgumentError.value(
annotation.uuid,
'annotation.uuid',
'A native redaction UUID is required.',
);
}
if (annotation.page < 0) {
throw ArgumentError.value(
annotation.page,
'annotation.page',
'The page index must not be negative.',
);
}
await _channel.invokeMethod<void>('apply_redaction', {
'page_index': annotation.page,
'uuid': annotation.uuid,
});
}