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

Free Support Forum - aspose.com

Form filling issue with radiobutton and checkbox


I have created a pdf form template using adobe acrobat pro and tried to fill the form using aspose pdf kit
it works fine for text fields but failed for radiobutton and checkbox…

the code is

string appPath = Server.MapPath(“Data”) + “\”;
Form form = new Form(appPath+“personaldetails.pdf”, appPath+“output.pdf”);

form.FillField(“sex”, “male”); //radiobutton – result failed
form.FillField(“qualifications”, “mca”); // checkbox – result failed
form.FillField(“name”, “sv”);// — result success

Hi Brad,

Please use FillField Method (String, Boolean) method to fill the CheckBox. It required a boolean value to specify whether the checkbox is checked or not. And, use FillField Method (String, Int32) method to select the option from the radio button options. It requires that provide the index of the value to be selected.

I hope this helps. If you still find any problems, please do let us know.


I upgraded to the latest version of the Aspose.Total tools today.

I’m curious why the FillField method is no longer smart enough to check checkboxes or select radio buttons, without explicitly having to pass in a Boolean or Int32 to it?

For example, it used to be very “generic” in that you could always just say this:

For i As Integer = 0 To DT.Rows.Count - 1

MyPdf.FillField(PdfFieldName, MyResponse)


And whether it was a textbox, checkbox, or radio button, it would fill/check/select based solely on the MyResponse string value matching one of the available options or not.

That made it very convenient and easy to use.

Whereas now I have to wrap logic around all of this to check to see if the field is a textbox, checkbox, radio button etc. and then pass in the string value, or a Boolean, or figure out an index.

Isn’t all of that information available and accessible from the PDF file already? So it should be able to intelligently fill those in accordingly without me having to tell it very specific instructions.

I guess my question is, if the old version (from 2008/2009) had that intelligence, why would the latest and greatest version (today’s version) lack that intelligence and convenience?


In addition to my previous question, is it no longer possible to have checkboxes with the same name and fill those accordingly?

I have 2 checkboxes named “Standards” and one has an export value of “Yes” and the other has an export value of “No”.

Previously I could just call:

MyPdf.FillField(“Standards”, “No”)


MyPdf.FillField(“Standards”, “Yes”)


MyPdf.FillField(“Standards”, String.Empty)

And it was always smart enough to check/uncheck it accordingly.

How would I accomplish this same behavior with the current version?


Hello Matt,

Thanks for using our products.

I am not entirely certain about your requirement of having two checkboxes with same name, however please note that Aspose.Pdf for .NET requires complete name of form field in order to update its value. As per your requirement of enabling/selecting the checkbox, you can still try using Form.FillField(“Lodging”, “Off”); where Lodging is checkbox field name. Please visit the following link for further details on Fill Form Fields in an Existing PDF File (Facades)

In case I have not properly understood your requirement or you have any further query, please feel free to contact. We are sorry for your inconvenience.

I still don’t have any luck trying to check a checkbox that exists multiple times with the same name, nor if it only exists once.

For example, this checkbox exists one time.


With an export value “Yes”.

If I try:

Form.FillField(“MCADOPT”, “Yes”)

It does not check.

If I try:

Form.FillField(MCADOPT, True)

Then it will check, but that doesn’t really help me because “generically” I won’t have a way to know whether to cast it to a Boolean (and which Boolean) or not since all I have is values at that point (Yes or No, or String.Empty).

Also, my requirements are such that there are controls with the same name.

For example, there are 2 controls called “Standards”. One has an export value of “Yes” and one has an export value of “No”.

Previously I could fill those like this:

Form.FillField(Standards, "Yes) – first one checked, second not checked
Form.FillField(Standards, “No”) – first one not checked, second one checked
Form.FillField(Standards, String.Empty) – niether checked

And that worked great. The code was short, sweet, and simple, and as generic as it could ever be (wrapped in a loop, example above is just for clarity).

But now I can’t do that. Nor can I do:

Form.FillField(Standards, True)


Form.FillField(Standards, False)

Since there are 2 of them and it doesn’t know what to do with them now I guess.

When I loop through all of the FieldNames in my PDF file it does show the “Standards” control in that list, but only once. And doesn’t seem like there is any way to get that field and iterate through it if it exists multiple times with different export values.

So basically I’m looking at having to uniquely name each and every checkbox or radio control, which doesn’t seem to make much sense, and will be a major undertaking for us, and seems like a giant step in the wrong direction, unless I’m just overlooking something obviously.

I appreciate any help or advice.


I’ve switched to iTextSharp for the time being as it behaves exactly how the older version of Aspose.Pdf used to before I upgraded.

FYI, I couldn’t just revert back to the older version of Aspose.Pdf because I need the latest version for some of the newer functionality, including the ability to add watermarks, etc.

But I must say that I’m a little bummed that the latest Aspose.Pdf version isn’t nearly as flexible or smart with how the FillField method.

Would still love to hear if there was a good reason for changing that functionality with regards to being able to have multiple controls with the same name (very standard approach), and also with regards to being able to pass in the export value for checkboxes or radio buttons instead of having to know the boolean value or the index, etc.


Hello Matt,

Sorry for delay in response.

We are trying to replicate this issue at our end and will keep you updated on the status of correction. However if possible, please share some sample PDF form along with the code snippet that you are using so that we can quickly replicate this issue in our environment. We are really sorry for this delay and inconvenience.

Take a look at the attached file (link). On the bottom of page 2 is a good example that used to work.

There are 2 checkboxes.

- One is called “Standards” with an export value of “Yes”
- The other is also called “Standards” with an export value of “No”.

This is the code I used to use (a generic version of it, but same result) and the expected behavior.

Form.FillField(Standards, "Yes) – first one checked, second not checked
Form.FillField(Standards, “No”) – first one not checked, second one checked
Form.FillField(Standards, String.Empty) – niether checked

But now that no longer works and I have no way to identify and fill those checkboxes.

With the older version of Aspose.Pdf it worked fine, and with iTextSharp it works fine too.


<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}


Hi Matt,

Thank you for sharing the template file and the details.

I am able to notice the problem that the latest Aspose.Pdf for .NET component only returns one checkbox field where as there are 2 checkbox fields with the same name. I have created an issue in our issue tracking system with issue id PDFNEWNET-33597 and asked the development team to check the issue and share a work around or analyze if this feature can be incorporated to the new Aspose.Pdf for .NET. I will update you as soon as I get a feedback from the development team.

Sorry for the inconvenience,

Was this fixed if so which version if not was was the workaround.


Hi Matt,

Thanks for your patience.

During our investigation, we have found that the source file which you have shared contains one field “Standards” with two child annotations. One of annotations has states “Off” and “Yes”, and other “Off” and "No"

The following code may be used to access to fields:


Document doc = new

Field f = doc.Form["Standards"] as Field;

f[1].ActiveState = "Yes";

f[2].ActiveState = "Off";


Document doc = new Document("amr.pdf");

Field f = doc.Form["Standard"] as Field;

f.ActiveState = "Yes";

Please try using the latest release version of Aspose.Pdf for .NET 7.6.0 and in case you still face the same problem or you have any further query, please feel free to contact.