anilpawar
Kilo Contributor

Hi Syed,



I am trying to generate a password protected pdf, I also tried using "setEncryption" function, but doesn't seem to work,



//this.writer = iTextPDFUtil.PdfWriter.getInstance(this.document, this.outputStream);


//PdfWriter writer = PdfWriter.getInstance(document, file);


//writer.setEncryption(USER_PASS.getBytes(), OWNER_PASS.getBytes(),PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128);



var USER_PASS = [72, 101, 108, 108, 111, 49, 50, 51]; //"Hello123";


var OWNER_PASS = [79, 119, 110, 101, 114, 49, 50, 51]; //"Owner123";


this.writer.setEncryption(USER_PASS, OWNER_PASS, this.writer.ALLOW_PRINTING, this.writer.STANDARD_ENCRYPTION_40);



Any suggestions.



Thanks


Anil