Free Support Forum - aspose.com

Checkbox not filling

Hi.

I'm having trouble filling a pdf form checkbox.

Here is the code I'm using and I've attached the pdf.

string inputFile = Path.Combine(System.Windows.Forms.Application.StartupPath, "Medical_Questionnaire.pdf");

string outputFile = Path.Combine(System.Windows.Forms.Application.StartupPath, "Medical_Questionnaire_Filled.pdf");

Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form(inputFile, outputFile);

pdfForm.FillField("TEST", "Yes");

pdfForm.FillField("CLIENT_FIRSTNAME", "John");

pdfForm.Save();

pdfForm = null;

I can fill the form using iTextSharp so I don't think there is a problem with the pdf. Also, when I use Aspose and then open the file in Adobe or Nitro, it asks if I want to save changes (doesn't do that when I use iTextSharp to do the form fill.

Thanks,

Sam

Hello Samantha,

Thanks for using our products.

In order to enable the CheckBox, please try using following code line. For your reference, I have also attached the resultant PDF that I have generated using Aspose.Pdf for .NET 6.1.0. We apologize for your inconvenience.

pdfForm.FillField(“TEST”, true);

Where True means enable the check-box and false represents un-check the check-box field.