How to add password protection to PDF using iText in Java?
The PdfWriter class provides the setEncryption() method to set the password protection on a pdf file. Syntax: public void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType) throws DocumentException. 1. userPassword – It specify the user password. 2. ownerPassword – It specify the owner password. 3. permissions – It specify the user permissions. 4. encryptionType … Read more