.FieldsNames.GetUpperBound(0) .... .FieldsNames(i)

Received : 2007/08/16 07:05:46
Message : Hi,
I am trying to open a pdf, loop through form fields and copy fieldnames into array.
I can do this nice and easy, however...

The field name contains [f0].p[0] etc.. i Just want the Name as it was created within PDF.

Is this possible, if so how ?

Thanks
Mark


This message was posted using Aspose.Live 2 Forum

Hi,

Thank you for considering Aspose.

In Aspose.Pdf.Kit.FormEditor we have a method name FillField which take the name of field as argument to fill the field. Please check the following link:

http://www.aspose.com/Products/Aspose.Pdf.Kit/Api/Aspose.Pdf.Kit.FormEditor.html

If you need more help please do let us know.

Thanks.

Dear Mark,

Thanks for considering Aspose.Pdf.Kit! I'd like to make what AdeelTaseer said more clear.

The name such as f[0].p[0].TextField1[0] is called The fully qualified field name, while the name created within PDF, i.e, TextField1, is called the partial field name. The fully qualified field name is not explicitly defined but is constructed from the partial field names of the field and all of its ancestors. For a field with no parent, the partial and fully qualified names are the same. For a field that is the child of another field, the fully qualified name is formed by appending the child field's partial name to the parent’s fully qualified name, separated by a period ( . ):

parent's_full_name . child's_partial_name

In Adobe 5 and 6, Form.FieldsNames will return all partial names, while in Adobe 7 and 8, it will return all the fully qualified field names. Because only them can be used to identify different fields in the new XFA architecture.

There is no special method to provide short names in Aspose.Kit.Pdf. However, you can remove all parent fully qualified name(i.e, the prefix[f0].p[0].) and the postfix([0]) to get a partial name from a fully qualified name(TextField).

Best regards.

Thanks for swift response.

I understand now, thanks.

I will use code to extract the partial name form fully qualified name. Is the partial name ( ie textfield1) always at the end of the string ?

Mark

Dear Mark,

Generally speaking, a field can only be a child of tables, pages or other containers. In other words, it CANNOT be an ancestor of some other elements. From the definition of the fully qualified field name, we can easily know that the field's partial name ( ie textfield1) DOES always at the end of the string, except the last square brackets with some integer number. At least, I didn't find any exception before.

If you have any other questions, please feel free to contact us :)

Best regards.