algorithm property
PdfEncryptionAlgorithm
get
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 = await document.save();
//Dispose the document.
document.dispose();
Implementation
PdfEncryptionAlgorithm get algorithm {
return _helper.encryptor.encryptionAlgorithm!;
}
set
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 = await document.save();
//Dispose the document.
document.dispose();
Implementation
set algorithm(PdfEncryptionAlgorithm value) {
_helper.encryptor.encryptionAlgorithm = value;
_helper.encryptor.encrypt = true;
_helper.encryptor.changed = true;
_helper.encryptor.hasComputedPasswordValues = false;
_helper.modifiedSecurity = true;
}