Free Support Forum -

Cannot check pdf checkbox with sub fields

I have attached an example project that includes a document from a customer that cannot be modified (protected). The document has a checkbox field that has sub fields. I am trying to figure out how to check one of the sub fields. See the source code for the details:

namespace ConsoleApplication1
class Program
static void Main(string[] args)
Aspose.Pdf.License license = new Aspose.Pdf.License();

Document doc = new Document(“test.pdf”);
Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(doc);

// Why can’t I check any of the boxes in the section titled “Frequency”?
// The field appears to be named “rbTITerm” but there is only one and this only sets the “weekly” option
// how do I set the other options?
form.FillField(“rbTITerm”, true);

// I’ve noticed that the field has a count of 8 but I don’t know how to get to the 8 sub fields:
Aspose.Pdf.InteractiveFeatures.Annotations.WidgetAnnotation w = doc.Form[“rbTITerm”];
if (w != null && w is Aspose.Pdf.InteractiveFeatures.Forms.Field)
Aspose.Pdf.InteractiveFeatures.Forms.Field af = w as Aspose.Pdf.InteractiveFeatures.Forms.Field;

// the count is 8. I need to get to set one of the 8 sub fields.
if (af.Count > 1)
foreach (Aspose.Pdf.InteractiveFeatures.Annotations.WidgetAnnotation subfield in af)
// I’ve checked the type of subfield and it is not a checkbox!!
if (subfield is Aspose.Pdf.InteractiveFeatures.Forms.CheckboxField)
(subfield as Aspose.Pdf.InteractiveFeatures.Forms.CheckboxField).Checked = true;

// how can I check it?

// this line works fine. Checks the box titled “Normal Distribution for Tax Year”
form.FillField(“chkDistributionReason7”, true);



Hi Darin,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the sample application.

I am able to reproduce your mentioned issue regarding selection of the checkboxes. Your issue has been registered in our issue tracking system for further investigation as PDFNEWNET-34520. We will inform you via this forum thread regarding any updates.

Sorry for the inconvenience,

Hi Darin,

Thanks for your patience. We have further investigated this issue and found that in order to change value of “grouped” checkbox i.e. when a group of checkboxes is grouped under one field (in this case checkboxes are dependent, i.e. only one of them may be checked), customer should assign name of checkbox in group to CheckboxField.Value property. (To uncheck all checkboxes, value “Off” may be assigned).


Document doc = new

CheckboxField field = doc.Form["rbTITerm"] as CheckboxField;

field.Value = "Annually";


Furthermore, in order to get list of valid checkbox names, new property AllowedStates was added to CheckboxField (It will be available with the release of Aspose.Pdf for .NET 7.6.0)

foreach (string state in field.AllowedStates)


The issues you have found earlier (filed as PDFNEWNET-34520) have been fixed in Aspose.Pdf for .NET 7.6.0.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.