After adding some text to the PDF file, you can set the document rights using the code snippet below:
Document document = new Document(inputFile);
DocumentPrivilege privilege = DocumentPrivilege.getForbidAll();
PdfFileSecurity fileSecurity = new PdfFileSecurity(document);
fileSecurity.setPrivilege(privilege);
document.save(outputFile);
This prohibits all rights to documents and the PDF file will no longer be edited. Hope this will be helpful. Please let us know if you need further assistance.
I work with Aspose as an evangelist developer.
source
share