clear method

void clear()

Remove all permissions from an existing PDF and set default.

//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 all permissions and set default.
permissions.clear();
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

void clear() {
  if (!(_permissions.contains(PdfPermissionsFlags.none) &&
      _permissions.length == 1)) {
    _permissions = <PdfPermissionsFlags>[PdfPermissionsFlags.none];
    _encryptor.permissions = _permissions;
    _encryptor.encrypt = true;
    _modifiedPermissions = true;
  }
}