I am trying to encrypt a new pdf that is created from a stream.
Some how for some documents i would encounter an error thrown from the encryption
Here is a snippet of the code and the exception:
Aspose.Pdf.Document document = new Aspose.Pdf.Document(filestreamtest);
DocumentPrivilege documentPrivilege = DocumentPrivilege.ForbidAll;
document.Encrypt("", “”, documentPrivilege, CryptoAlgorithm.AESx128, false);
System.InvalidCastException: Unable to cast object of type ‘a.’ to type ‘a.’. at a....(a , & , ).
I am unable to see any pattern with the documents that is being encrypted.
Please advise. thank you.