This Solution provides a general utilty for encrypting and decrypting any document.
public class Test { private Logger log= Logger.getLogger(getClass()); public static void main(String[] args) { Test obj=new Test(); obj.t1(); } public void t1() { try { String sourcePath="c:\\encrpt1.pdf"; String destPath="c:\\encrpt.pdf"; /*Encryption encrp = new Encryption(true, "BruceWyne"); encrp.encrypt(2, sourcePath , destPath); Decryption decrp = new Decryption(true, "BruceWyne"); decrp.decrypt(destPath, sourcePath); } catch (Exception e) { e.printStackTrace(); } } }