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

Free Support Forum - aspose.com

Cannot Set Checkbox Value Using form.FillField

Using Apose.Pdf version 6.8 (yes I know it’s an older version but it is the version I have to use) I am having an issue setting checkbox values using form.FillField. I can set textboxes with no issue but the checkboxes won’t render a checked state.

//Get the form for manipulation (form is an embedded resource and the GetFormResource returns the stream
var form = new Form(new FormAccessHelper().GetFormResource(“nFocus.Modules.Army.Forms.Resources.PDF_DAForm705.pdf”));

//Header Information (Populates fine)
form.FillField(“form1[0].Page1[0].NAME[0]”, Convert.ToString(row[“FullName”]));
form.FillField(“form1[0].Page1[0].GENDER[0]”, Convert.ToString(row[“Gender”]));
form.FillField(“form1[0].Page1[0].UNIT[0]”, Convert.ToString(row[“OrganizationName”]));

bool go_NoGo = Convert.ToString(row[“WeightGo_0”]).ToUpper() == “X”;//tests false
form.FillField(“form1[0].Page1[0].GO_A[0]”, go_NoGo);
go_NoGo = Convert.ToString(row[“WeightGoNoGo_0”]).ToUpper() == “X”; //tests true
form.FillField(“form1[0].Page1[0].NOGO_A[0]”, go_NoGo);

form.Save();

When everything looked good while debug I decided to see what the immediate window would show for the method calls (code below was run in the immediate window) :

//Field Type
form.GetFieldType(“form1[0].Page1[0].GO_A[0]”)
CheckBox

//Before the field is filled
form.GetField(“form1[0].Page1[0].GO_A[0]”)
“Off”

//Setting the field to false
form.FillField(“form1[0].Page1[0].GO_A[0]”, false);
true

//After the field is set to false
form.GetField(“form1[0].Page1[0].GO_A[0]”)
“0”

//Setting the field to true
form.FillField(“form1[0].Page1[0].GO_A[0]”, true);
true

//After Setting the field to true
form.GetField(“form1[0].Page1[0].GO_A[0]”)
“2”

Any help or advice anyone could give would be much appreciated!

PDF_DAForm705.pdf (114.2 KB)

Thanks!

@dfriesen

Thanks for posting your inquiry.

We have tested the scenario in our environment using Aspose.PDF for .NET 18.9 (we regret that we cannot test using this older version which you have mentioned.) and were unable to notice any issue. form_out.pdf (117.6 KB)

Please note that, this is always recommended to use latest version because it contains more fixes and improvements. Moreover, issues reported for earlier version(s) of the API also get resolved/fixed in latest release. I am afraid to share that we cannot resolve issue in an older version of the API as many new features and changes have been made after 6.8 version.

We request you to please update your API version and in case you face any issue using latest release, please share with us. We will definitely log an issue in our environment and proceed further to fix it.