0
votes

I have to fill a certified PDF form with itext. This form has been built with Adobe Life Cycle and contains, among others, image fields (PushButtonField).

With Adobe Reader, I can fill all types of fields, without breaking the certification signature, including image fields.

With itext, filling other types of fields works just fine, but when I try to fill the existing image fields, it breaks the form certification. I tried different ways, without success.

Way 1:

AcroFields form = pdfStamper.getAcroFields();
form.setField(fieldName, b64EncodedJpegByteArray)

With this code, image is displayed in Adobe Reader, but certification signature is broken.

Way 2 :

AcroFields form = pdfStamper.getAcroFields();
PushbuttonField pb = form.getNewPushbuttonFromField(fieldName);
pb.setImage(Image.getInstance(jpegByteArray);
form.replacePushbuttonField(fieldName, pb.getField());

With this one, the certification is also broken and the image is not displayed in Adobe Reader any more...

Has anyone met this before?

1

1 Answers

0
votes

I don't work with iText much anymore but I am familiar with the changes that are permissible to a PDF without breaking the Certification and your last line...

form.replacePushbuttonField(fieldName, pb.getField());

... may a step too far. You can only change field values and/or appearances, not replace fields, which changes the AcroForm dictionary.

You need to figure out how to use iText to change the default or "Normal" appearance of the button.