Form.FillField

FillField(string, string, bool)

Fills field with specified value.

public bool FillField(string fieldName, string value, bool fitFontSize)
ParameterTypeDescription
fieldNameStringName of field
valueStringNew value of the field
fitFontSizeBooleanIf true, the font size in the edit boxes will be fitted.

Return Value

true if field was found and successfully filled.

See Also


FillField(string, string)

Fills the field with a valid value according to a fully qualified field name. Before filling the fields, every field’s names and its corresponding valid values must be known. Both the fields’ name and values are case sensitive. Please note that Aspose.Pdf.Facades supports only full field names and does not work with partial field names in contrast with Aspose.Pdf.Kit; For example if field has full name “Form.Subform.TextField” you should specify full name and not “TextField”. You can use FieldNames property to explore existing field names and search required field by its partial name.

public bool FillField(string fieldName, string fieldValue)
ParameterTypeDescription
fieldNameStringThe field’s name to be filled.
fieldValueStringThe field’s value which must be a valid value for some fields.

Return Value

true if field is found and filled successfully.

Examples

Form form = new Form(TestSettings.GetInputFile("PdfForm.pdf"));
form.FillField("FirstName", "John");
form.FillField("LastName",  "Smith");
//how to search field by its partial name:
Form form = new Form("input.pdf", "output.pdf"); 
foreach(string fieldName in form.FieldNames)
{
  if (fieldName.EndsWith("TextField"))
  {
    Console.WriteLine("Full name is: " + fieldName);
  }
}

See Also


FillField(string, int)

Fills the radio box field with a valid index value according to a fully qualified field name. Before filling the fields, only field’s name must be known. While the value can be specified by its index. Notice: Only be applied to Radio Box, Combo Box and List Box fields. Please note that Aspose.Pdf.Facades supports only full field names and does not work with partial field names in contrast with Aspose.Pdf.Kit; For example if field has full name “Form.Subform.ListBoxField” you should specify full name and not “ListBoxField”. You can use FieldNames property to explore existing field names and search required field by its partial name.

public bool FillField(string fieldName, int index)
ParameterTypeDescription
fieldNameStringName of field to be filled.
indexInt32Index of chosen item.

Return Value

true if field was found and successfully filled.

Examples

Form form = new Form("PdfForm.pdf");
form.FillField("listboxField", 2);
form.FillField("comboboxField", 2);
form.FillField("radiobuttonField", 2);
//how to search field by its partial name:
Form form = new Form("input.pdf", "output.pdf"); 
foreach(string fieldName in form.FieldNames)
{
  if (fieldName.EndsWith("ListBoxField"))
  {
    Console.WriteLine("Full name is: " + fieldName);
  }
}

See Also


FillField(string, bool)

Fills the check box field with a boolean value. Notice: Only be applied to Check Box. Please note that Aspose.Pdf.Facades supports only full field names and does not work with partial field names in contrast with Aspose.Pdf.Kit; For example if field has full name “Form.Subform.CheckBoxField” you should specify full name and not “CheckBoxField”. You can use FieldNames property to explore existing field names and search required field by its partial name.

public bool FillField(string fieldName, bool beChecked)
ParameterTypeDescription
fieldNameStringThe field’s name to be filled.
beCheckedBooleanA boolean flag: true means to check the box, while false to uncheck it.

Return Value

true if field was found and successfully filled.

Examples

Form form = new Form("PdfForm.pdf");
form.FillField("checkboxField", true);
//how to search field by its partial name:
Form form = new Form("input.pdf", "output.pdf"); 
foreach(string fieldName in form.FieldNames)
{
  if (fieldName.EndsWith("CheckBoxField"))
  {
    Console.WriteLine("Full name is: " + fieldName);
  }
}

See Also


FillField(string, string[])

Fill a field with multiple selections.Note: only for AcroForm List Box Field.

public void FillField(string fieldName, string[] fieldValues)
ParameterTypeDescription
fieldNameStringThe fully qualified field name.
fieldValuesString[]A string array which contains several items to be selected.

Examples

Form form = new Aspose.Pdf.Facades.Form("PdfForm.pdf", "Form_Updated.pdf");
form.FillField("ListBox1", new String[] { "Three", "One" });
form.Save();

See Also