Hello,

I need to add a new hidden fields to a PDAcroForm. How can i do this?
I already created the following code, that changes the values of existing fields, but i need to create new fields and add the to the PDAcroForm. The fields should be hidden.

document = PDDocument.load(req.getInputStream());
final PDPage page = (PDPage) document.getDocumentCatalog().getAllPages().get(document.getNumberOfPages() - 1);
final PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm();
for (final PDField field : (List<PDField>) acroForm.getFields()) {
    switch (field.getFullyQualifiedName()) {
        case "myField": {
            field.setValue("newValue");
            break;
        }
        default:
    }
}
document.save("Z:/1.pdf");
document.close();

Thanks for your reply in advance!

Best regards,
RoMe

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to