We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Not listing all field names on XFA form

I am currently evaluating your product (aspose-pdf-9.1 for java) and I have been conducting various test to determine if your product will fit our needs. I have an instance of a Adobe Dynamic PDF form that contains a total of 4 fields. I would expect this block of code to return all 4 fields:

String[] fieldNames = pdfDocument.getForm().getXFA().getFieldNames();
for(String xfaf : fieldNames){
System.out.println("XFA Field: "+xfaf);

The expected output of this call should be:
XFA Field: form1[0].#subform[0].ItemNumber[0]
XFA Field: form1[0].#subform[0].SourceDescription[0]
XFA Field: form1[0].#subform[0].ItemNumber[1]
XFA Field: form1[0].#subform[0].SourceDescription[1]

But instead I only receive:
XFA Field: form1[0].#subform[0].ItemNumber[0]
XFA Field: form1[0].#subform[0].SourceDescription[0]

Continuing testing with this dynamic form I can successfully set the value of the two seemingly missing fields and save the resulting PDF to verify:
xfa.set_Item(“form1[0].#subform[0].ItemNumber[0]”, “123”);
xfa.set_Item(“form1[0].#subform[0].SourceDescription[0]”, “456”);
xfa.set_Item(“form1[0].#subform[0].ItemNumber[1]”, “789”);
xfa.set_Item(“form1[0].#subform[0].SourceDescription[1]”, “101112”);

The resulting PDF has the fields filled correctly as specified above. I know the fields are there, but getXFA().getFieldNames() is not listing them.

Aside, Saving this same form as a Static PDF, and using a call to:
Field[] fields = pdfDocument.getForm().getFields();
will return all 4 fields as expected.

Also, renaming the fields so they are unique solves this issue in the dynamic form as well.

Is there a way to get the field names when they are not unique within an XFA form? This seemingly would prevent users from programatically filling out a form like this without guessing. Is this just a side effect of this being an evaluation version? Thank you.

Hi Brian,

We are sorry for the inconvenience caused. While testing the scenario with the latest version of Aspose.Pdf for Java 9.1.0, we have managed to reproduce the reported issue and logged it in our bug tracking system as PDFNEWJAVA-34242 for further investigation and resolution. We will notify you via this thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWJAVA-34242) have been fixed in Aspose.Pdf for Java 9.3.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.