I have a requirement where i have to populate values in a PDF Form using Itext.
the Form i have has multiple fields with the same field names. The Concept is to populate same value in case the PDF form field name is common.
so if there is are 2 or more fields with the name txtSysTime, then the code should fill the system time in all the fields.
My question is basically
I am using the below code for attempting the same:
PdfReader pdfTemplate = new PdfReader(inputFilePath);
FileOutputStream fileOutputStream = new FileOutputStream(outputFilePath);
ByteArrayOutputStream out = new ByteArrayOutputStream();
PdfStamper stamper = new PdfStamper(pdfTemplate, fileOutputStream);
stamper.setFormFlattening(true);
stamper.getAcroFields().setField("TextBox", "value filled");
With this code the value in the first field with the same name is populated correctly but the rest of it is left blank.
Please help
PDF forms does not support 2 fields with the same name. requirement is invalid