The form collection is returning null for half of the form objects for some pdf files. Attached is an example file. Note, 41 fields in the collection and 20 are returned as null.
Here is the code.
File oPath = new File(Environment.getExternalStorageDirectory(), "Documents");
File oPdfLic = new File(oPath, "aspose_pdf.lic");
File oFormIn = new File(oPath, "form.pdf");
FileInputStream oStream = new FileInputStream(oPdfLic.getAbsolutePath());
License oLicense = new License();
oLicense.setLicense(oStream);
oStream.close();
{
com.aspose.pdf.Document oDoc = new com.aspose.pdf.Document(oFormIn.getAbsolutePath());
Form oForm = oDoc.getForm();
log("debug", "fields: " + oForm.size());
// build our index list //
for (int i = 0; i < oForm.size(); i++)
{
WidgetAnnotation oField = oForm.get_Item(i + 1);
if (oField == null)
{
log("debug", "field is null");
continue;
}
String szName = oField.getFullName();
log("debug", "field: " + szName);
}
}
form.pdf (694.0 KB)