security property Null safety

PdfSecurity security

Gets the security features of the document like encryption.

//Create a new PDF document.
PdfDocument document = PdfDocument();
//Document security
PdfSecurity 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;
//Dispose the document.


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