I am able to fetch the field names for most of the pdf files using pdfbox but i am not able to fetch fields income taxform. is it something restricted in that form.
though it contains multiple fields in the form, it is showing only one field.
This is the output:
topmostSubform[0].
my code:
PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
PDAcroForm acroForm = docCatalog.getAcroForm();
List fields = acroForm.getFields();
@SuppressWarnings("rawtypes")
java.util.Iterator fieldsIter = fields.iterator();
System.out.println(new Integer(fields.size()).toString());
while( fieldsIter.hasNext())
{
PDField field = (PDField)fieldsIter.next();
System.out.println(field.getFullyQualifiedName());
System.out.println(field.getPartialName());
}
used in
public static void main(String[] args) throws IOException {
PDDocument pdDoc = null;
try {
pdDoc = PDDocument.load("income.pdf");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Ggdfgdgdgf feilds = new Ggdfgdgdgf();
feilds.printFields(pdDoc);
}