How to discover field name and set its value

I have a pdf document a customer provided. Your help file says that I need to open the document in Adobe Professional to find out the names of all the fields. I don't have Adobe Professional. Is there any other way to do it ( programmatically or manually)? I need to be able to populate each of the fields in that pdf document with some value.

I'm using Visual Studio 2005, C# web app.

thanks,

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

I am pleased to inform you that, Aspose.Pdf.Kit offers the capability to read the Form field names and fill them programmatically. For more information and sample code, please visit Identifying form fields names.

Incase of any further issues, please feel free to contact.

I used the code from your link to discover what the field names are in the pdf document my customer provided. I don't think the field names were supplied. Because of that, the field names seem to be automatically generated, for example the first field name shows up as:

form1[0].#subform[0].TextField1[0]

This is what allfields[i] returns from the code below ( sample code from your website). I tried to access that field using:

form.FillField("form1[0].#subform[0].TextField1[0]", "1234");

But I'm getting an "object reference not set" exception. I also tried to rename that field by doing:

editor.RenameField(allfields[i], "Item" + i);

but I'm getting the same exception. So if the field names are not set in the pdf document, how can I populate these fields with values?

thanks,

//First a input pdf file should be assigned

Aspose.Pdf.Kit.Form form = new Aspose.Pdf.Kit.Form(@"c:\pdftest\FilledForm.pdf");

//get all field names

String[] allfields = form.FieldsNames;

// Create an array which will hold the location coordinates of Form fields

System.Drawing.Rectangle[] box = new System.Drawing.Rectangle[allfields.Length];

for (int i = 0; i < allfields.Length; i++)

{

// Get the appearance attributes of each field, consequtively

FormFieldFacade facade = form.GetFieldFacade(allfields[i]);

//Box in FormFieldFacade class holds field's location.

box[i] = facade.Box;

}

form.Save();

// Now we need to add a textfield just upon the original one

FormEditor editor = new FormEditor(@"c:\pdftest\FilledForm.pdf", @"c:\pdftest\new_test_form_updated.pdf");

for (int i = 0; i < allfields.Length; i++)

{

// add text field beneath every existing form field

editor.AddField(FieldType.Text, "TextField" + i, allfields[i], 1, box[i].Left, box[i].Top, box[i].Left + 50, box[i].Top + 10);

}

//Close the document

editor.Save();

Hi,

Please share the resource Pdf form so that we can test the issue at our end. Also it would be more helpful if you could share the information regarding how the Pdf form was generated (Tool and Version information).