Below is the source code which we tried:
var dir = "/Users/sgovindan/RiderProjects/aspose-word/aspose-word/Docs/";
// Initialize license object
Aspose.Words.License WordLicense = new Aspose.Words.License();
// Set license
WordLicense.SetLicense(dir + "Aspose.Total.Product.Family.lic");
// Open the document
Document doc = new Document(dir + "aws.docx");
var options = new PdfSaveOptions();
PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails("password", "sathish");
encryptionDetails.Permissions = PdfPermissions.DisallowAll;
options.EncryptionDetails = encryptionDetails;
options.Compliance = PdfCompliance.PdfA1b;
doc.Save(dir + "Transformed.pdf", options);
We are using latest aspose.words
<PackageReference Include="Aspose.Words" Version="23.5.0" />
This is our input file: aws.docx (24.0 KB)
And Output file generated which is losing encryption because of defect in Aspose.word lib: Transformed.pdf (25.2 KB)
But when there is no compliance added encryption is working as expected. Please try this issue and let us know what is going wrong