permissions property
PdfPermissions
get
permissions
Gets the permissions when the document is opened with user password.
We can add or remove permissions flags by using add() and remove() method in PdfPermissions class.
//Load an exisiting PDF document.
PdfDocument document = PdfDocument.fromBase64String(pdfData, 'password');
//Get the permissions.
PdfPermissions pdfPermissions = document.security.permissions;
//Add permissions
permissions.add(<PdfPermissionsFlags>[PdfPermissionsFlags.editContent, PdfPermissionsFlags.copyContent]);
//Remove permissions
permissions.remove(<PdfPermissionsFlags>[PdfPermissionsFlags.editContent, PdfPermissionsFlags.copyContent]);
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();
Implementation
PdfPermissions get permissions {
_permissions ??=
PdfPermissions._(_helper.encryptor, _helper.encryptor.permissions);
return _permissions!;
}