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!