Protect PDF via Java
Set document privileges for PDF with AES-128 encryption. Use Aspose.PDF for Java to modify PDF documents programmatically
How to Protect PDF File Using Using Java Tool
In order to protect PDF, we’ll use Aspose.PDF for Java API which is a feature-rich, powerful and easy to use conversion API for Java platform. You can download its latest version directly from Maven and install it within your Maven-based project by adding the following configurations to the pom.xml.
Protect PDF via Java
You need Aspose.PDF for Java to try the code in your environment.
- Load the PDF with an instance of Document.
- Create an object of DocumentPrivilege & set options.
- Call Document.Encrypt method to protect PDF with AES-128.
- Save result in PDF format