Error referencing form fields.
Article ID: A1014
Last Review: June 12, 2006
Revision: 1.0
On This Page
Product it applies to
Symptoms
Cause
Resolution
Sample Code
Remarks
PRODUCT IT APPLIES TO
- DynamicPDF Merger for .NET
- DynamicPDF Merger for Java
- DynamicPDF Merger for COM/ActiveX
SYMPTOMS
- Unable to populate the form fields.
- Unable to reference a form field.
- FieldList.Count() returns a value of 1, even if the PDF form has more than one form fields.
- Unable to access the form fields for use in CreateLabel() or PositionPageElement() methods of the PdfFormField class.
CAUSE
This happens generally while filling in PDF documents that are created in Adobe Designer. Designer typically saves the names of the form fields
in a hierarchical manner. A form field's name could be the concatenation of its parent's name. For example a form field name might
be "Parent2.Parent1.FormFieldName" instead of "FormFieldName" as might be expected.
RESOLUTION
The form field's FullName must be used while filling in the fields or when accessing methods like CreateLabel() or PositionpageElement().
The Parent-Child relationship (i.e. "Parent.Child") has to be used as the full name of the form field where "Child" is the form field's actual
name, and "Parent" is its parent field's name. The "." is a delimiter representing the parent child relationship between the form fields in the
PDF document.
SAMPLE CODE
C#: document.Form.Fields["form1[0].#subform[0].TextField1[0]"].Value = "ceTe Software";
VB.NET: MyDocument.Form.Fields("form1(0).#subform(0).TextField1(0)").Value = "ceTe Software"
Java: document.getForm().getFields().getFormField("form1[0].#subform[0].TextField1[0]").setValue("ceTe Software");
ASP: MyDocument.Form.Fields.Item("form1(0).#subform(0).TextField1(0)").Value = "ceTe Software"
REMARKS
You can use the sample "FormFieldReader" example included with the download of our product to find out the full names of any form fields that
are unknown in your PDF.
|