We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Set read only property for pdf generated document


I am using ReportingEngine to generate pdf files, but I wnat to make them read only (copy + paste functions disable). I used the following code, but it doesn’t work :

ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, myData, “data”);

Can you please assist with this topic? Thank you!


Thanks for your inquiry. Please use PdfSaveOptions.EncryptionDetails property as shown below to set the detail for encrypting the output PDF document. Hope this helps you.

Document doc = new Document(MyDir + "input.docx");

//Your code...

PdfSaveOptions saveOptions = new PdfSaveOptions();

// Create encryption details and set owner password.
PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails(String.Empty, "password", PdfEncryptionAlgorithm.RC4_128);

// Start by disallowing all permissions.
encryptionDetails.Permissions = PdfPermissions.DisallowAll;

saveOptions.EncryptionDetails = encryptionDetails;

// Render the document to PDF format with the specified permissions.
doc.Save(MyDir + "18.11.pdf", saveOptions);


thanks for your help, now it works fine.


Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.