security property

PdfSecurity security

Gets the security features of the document like encryption.

//Create a new PDF document.
PdfDocument document = PdfDocument();
//Document security
PdfSecurity security = document.security;
//Set security options
security.keySize = PdfEncryptionKeySize.key128Bit;
security.algorithm = PdfEncryptionAlgorithm.rc4;
security.userPassword = 'password';
security.ownerPassword = 'syncfusion';
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

PdfSecurity get security {
  _helper._security ??= PdfSecurityHelper.getSecurity();
  if (_helper.conformanceLevel != PdfConformanceLevel.none) {
    PdfSecurityHelper.getHelper(_helper._security!).conformance = true;
  }
  return _helper._security!;
}