addAll method
Add the permissions.
//Create a new PDF document.
PdfDocument document = PdfDocument();
//Document security
PdfSecurity security = document.security;
//Add permissions.
security.permissions.addAll(<PdfPermissionsFlags>[
PdfPermissionsFlags.editContent,
PdfPermissionsFlags.copyContent]);
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();
Implementation
void addAll(List<PdfPermissionsFlags> permission) {
bool isChanged = false;
if (permission.isNotEmpty) {
permission.toList().forEach((PdfPermissionsFlags flag) {
if (!_permissions.contains(flag)) {
_permissions.add(flag);
isChanged = true;
_modifiedPermissions = true;
}
});
}
if (isChanged) {
_encryptor.permissions = _permissions;
_encryptor.encrypt = true;
_modifiedPermissions = true;
}
}