algorithm property Null safety

PdfEncryptionAlgorithm algorithm

Gets the type of encryption algorithm used.

//Load an exisiting PDF document.
PdfDocument document = PdfDocument.fromBase64String(pdfData, 'password');
//Get encryption algorithm
PdfEncryptionAlgorithm algorithm = document.security.algorithm;
//Save the document.
List<int> bytes = document.save();
//Dispose the document.
document.dispose();

Implementation

PdfEncryptionAlgorithm get algorithm {
  return _encryptor.encryptionAlgorithm!;
}
void algorithm=(PdfEncryptionAlgorithm value)

Sets the type of encryption algorithm.

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

Implementation

set algorithm(PdfEncryptionAlgorithm value) {
  _encryptor.encryptionAlgorithm = value;
  _encryptor.encrypt = true;
  _encryptor._isChanged = true;
  _encryptor._hasComputedPasswordValues = false;
  _modifiedSecurity = true;
}