I am trying to generate a read-only pdf file with Aspose.words for Java, and I found the following article which give the sample code with C#. I couldn’t find the similar classes in Aspose.words for java. Could you show me how to generate a read-only pdf file with Aspose.Words for Java? Generate ReadOnly Pdf
Thanks for your inquiry. Please use following code example to achieve your requirements. Hope this helps you.
Document doc = new Document(MyDir + "in.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions();
// Create encryption details and set owner password.
PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails("", "password", PdfEncryptionAlgorithm.*RC_4_128*);
// Start by disallowing all permissions.
encryptionDetails.setPermissions(PdfPermissions.DISALLOW_ALL);
saveOptions.setEncryptionDetails(encryptionDetails);
// Render the document to PDF format with the specified permissions.
doc.save(MyDir + "Out.pdf", saveOptions);