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

Free Support Forum - aspose.com

Form Fields positions not extracted correctly


I have two documents. Attached document 1 and document 2.

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;

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

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 = 792 - box.Y - box.Height;
adobe_ft.width = box.Width;
adobe_ft.height = box.Height;


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


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

1. For document1, I think the x,y,width and height are correctly given. But for document2, the height seems to have messed up. It is giving a longer height value.
2. Is there any other way to correctly get the x,y,width and height? How would you extract the coordinates and box dimensions of each field?

Thank you,

Hi Sireesha,

Thanks for your inquiry. I have tested the scenario and noticed the field positioning issue with document2.pdf, so logged a ticket PDFNEWNET-39486 in our issue tracking system for further investigation and resolution. Moreover FormFieldFacade is recommend to get form field position.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan