I am using itext to manipulate a existing pdf. To achieve so I need to first get the list of name of the fields.
I use this code to get the list
PdfDocument pdfDoc = new PdfDocument(new PdfReader("tempPdf.pdf"), new PdfWriter("pdfEdited.pdf"));
PdfAcroForm acroForm = PdfAcroForm.getAcroForm(pdfDoc, false);
Map<String,PdfFormField> fields = acroForm.getFormFields();
for (String fldName : fields.keySet()) {
System.out.println( fldName + ": --" + fields.get( fldName ).getValueAsString() );
}
pdfDoc.close();
The problem is I dont get the names of the fields instead get something like this which is not helpful. Is this becuase the pdf actually has these names for fields ?
pdfTemp[0].Page5[0].Table3[0].BodyRow2[0].f5_029[0]: --
pdfTemp[0].Page5[0].Table3[0].BodyRow2[0].f5_030[0]: --
pdfTemp[0].Page5[0].Table3[0].BodyRow2[0].f5_031[0]: --
pdfTemp[0].Page5[0].Table3[0].BodyRow2[0].f5_032[0]: --