Hi all,
I'm trying to set encryption using the setEncryption method. Below is the a
snippet of the source
PdfReader reader = new PdfReader(inputPDFFormByteArr);
PdfStamper stamper = new PdfStamper(reader, outputStream);
FdfReader fdfReader = new FdfReader(fdfByteArr);
int permissions = reader.getPermissions();
boolean strength = reader.is128Key();
AcroFields form = stamper.getAcroFields();
String ownerPassword = "password"
form.setFields(fdfReader);
if ( ownerPassword != null && !"".equals(ownerPassword) ) {
stamper.setEncryption( strength, null, ownerPassword, permissions );
}
When the call to setEncryption is made an exception is thrown
com.lowagie.text.DocumentException: Content was already written to the output.
at com.lowagie.text.pdf.PdfStamper.setEncryption([B[BIZ)V(PdfStamper.java:293)
at
com.lowagie.text.pdf.PdfStamper.setEncryption(ZLjava.lang.String;
Ljava.lang.String;I)V(PdfStamper.java:311)
Any ideas why?
I started to look at the IText code and it throws the exception when the
PdfBody.size() > 1. Does that mean I have to setEncryption() before I do
form.setFields(fdfReader)?
Thanks for the help,
Abhay.
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions