Not all Adobe fields are extracted in Form Fields

Hi,

Environment: Libraries 10.3 and 10.9.0 (release Oct 2,2015)

I want to extract Adobe form fields and noticed that out of 68, only 35 are extracted. Why is that the case? How can I extract all 68 of them?
I attached document reg135.pdf as a use case.

I use the following code to extract location coordinates of the form fields:

//Step 1: Get all Adobe fields.
Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(filename);

Aspose.Pdf.Facades.FormFieldFacade fieldfacade = null;
string field_value = null;

//get all field names
String[] allfields = form.FieldNames;
Aspose.Pdf.PageCollection pageCollection = pdfDocument.Pages;

foreach (string mFieldName in allfields)
{
try
{
fieldfacade = form.GetFieldFacade(mFieldName);
field_value = form.GetField(mFieldName);

Aspose.Pdf.Page pdfPage = pageCollection[textFragment.Page.Number];

if (String.IsNullOrEmpty(field_value)){

//Break it down & form the json data
System.Drawing.Rectangle box = fieldfacade.Box;

dynamic adobe_ft = new System.Dynamic.ExpandoObject();
adobe_ft.page_number = fieldfacade.PageNumber - 1;
adobe_ft.required = form.IsRequiredField(mFieldName);
adobe_ft.x = box.X;
adobe_ft.label = mFieldName;
adobe_ft.y = pdfPage.MediaBox.Height - box.Y - box.Height;
adobe_ft.width = box.Width;
adobe_ft.height = box.Height;

mAdobeDefinedfields.Add(adobe_ft);

fieldfacade.Reset();// resets all visual attributes to empty value.

}

} catch(Exception e){
if (e.Message.Contains(“cannot”))
{
// Trace.WriteLine("---- Field cannot be found: "+mFieldName);
}
}

Questions:
1. How can I get all 68 form fields with the code given above? Can you please suggest a solution? Or let me know if this is a bug?
2. This is follow up for another issue: Form Fields positions not extracted correctly and you’ve logged a ticket for it: PDFNEWNET-39486 to correct the height values of form fields extracted. When is the fix for this expected?

Thank you,
Sireesha

Hi Sireesha,

Thanks for your inquiry.

sireesha.charyulu:

Questions:
1. How can I get all 68 form fields with the code given above? Can you please suggest a solution? Or let me know if this is a bug?


Please note your form has 33x2=66 text fields, each text field has its duplicate copy with same name, and two push buttons. So it is not a bug, however if you want to get position of both fields then please check following code snippet for the purpose.

var pdf1 = new Document("reg135.pdf");

var formtyp = pdf1.Form.Type;

var pdfForm = new Aspose.Pdf.Facades.Form(pdf1);

foreach (var field in pdf1.Form.Fields)

{

var fieldFullName = field.FullName;

var facadeField = pdfForm.GetFieldFacade(fieldFullName);

var fieldType = pdfForm.GetFieldType(fieldFullName);

if (field.Count > 0)

{

foreach (Aspose.Pdf.InteractiveFeatures.Annotations.Annotation annot in field)

{

//System.Console.WriteLine(annot.Rect);

Console.WriteLine("Field Name: {0}, Field Type: {1}, count: {2}, rect: {3}", fieldFullName, fieldType,field.Count, annot.Rect);

}

}

else

Console.WriteLine("Field Name: {0}, Field Type: {1}, count: {2}", fieldFullName, fieldType,field.Count);

}


sireesha.charyulu:

Questions:
2. This is follow up for another issue: https://forum.aspose.com/t/27990 and you've logged a ticket for it: PDFNEWNET-39486 to correct the height values of form fields extracted. When is the fix for this expected?

In reference to PDFNEWNET-39486, I am afraid it is still not resolved. It is pending for investigation as we have recently noticed the issue. We will notify you as soon as we made some significant progress towards issue resolution.

Best Regards,

Thank you… looking forward for the fix on (2)issue.

Hi Sireesha,


Thanks for your feedback.It is good to know that shared information worked for you. Moreover, we will keep you updated about your second issue.

Thanks for your patience and cooperation.

Best Regards,