I have a method that combines multiple PDF files and applies security settings. However, when I try to add encryption, I receive the error BC30454: “Expression is not a method.”
This is a .NET Framework 4.8 Web application using Aspose.PDF version 25.12.0.
Dim merged As New Aspose.Pdf.Document()
If Not String.IsNullOrWhiteSpace(passcode) Then
' userPassword: required to open the PDF
' ownerPassword: controls permissions (use different one if you want stronger control)
merged.Encrypt(
passcode, ' userPassword
passcode, ' ownerPassword
Permissions.PrintDocument, ' allow printing only
Aspose.Pdf.CryptoAlgorithm.AESx128 ' AES-128 encryption
)
End If