I'm trying to fill out a PDF form using the AcroFields class. I'm able to add text data perfectly, but I'm having issues adding images. How is this done?
The "official" way to do this, is to have a Button field as placeholder for the image, and to replace the "icon" of the button like this:
PushbuttonField ad = form.getNewPushbuttonFromField(imageFieldName); ad.setLayout(PushbuttonField.LAYOUT_ICON_ONLY); ad.setProportionalIcon(true); ad.setImage(Image.getInstance("E:/signature/signature.png")); form.replacePushbuttonField("advertisement", ad.getField());
See ReplaceIcon.java for the full code sample.