remove method
Remove permissions from an existing PDF.
//Load encrypted PDF document with password.
PdfDocument document = PdfDocument(inputBytes: pdfData, password: 'password');
//Document security
PdfSecurity security = document.security;
//Gets the pdf permission.
PdfPermissions permissions = security.permissions;
//Remove permission.
permissions.remove(PdfPermissionsFlags.editContent);
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();
Implementation
void remove(PdfPermissionsFlags permission) {
if (_permissions.contains(permission)) {
_permissions.remove(permission);
_encryptor.permissions = _permissions;
_encryptor.encrypt = true;
_modifiedPermissions = true;
}
}