I have a radio group which I am trying to fill using iTextSharp
library. When I opened the PDF in iText RUPS
I see the following:
This is how it is in the PDF file:
I have the following code-behind which is supposed to populate either MALE or FEMALE radio button:
if (reader.GetValue(4).ToString() == "M")
{
pdfFormFields.SetField("SEXpg2", "Yes");
}
else
{
pdfFormFields.SetField("SEXpg2", "Yes");
}
When I run the PDF form, none of the radio is populated. How can I modify the code from the screenshot so it populates either radio based on the gender column from the sql query?
I tried the following but that didn't work:
if (reader.GetValue(4).ToString() == "M")
{
pdfFormFields.SetField("MALEpg2", "Yes");
}
else
{
pdfFormFields.SetField("FEMALEpg2", "Yes");
}
+1 for using iText RUPS!
You should be able to do:
pdfFormFields.SetField("SEXpg2", "MALEpg2");
and
pdfFormFields.SetField("SEXpg2", "FEMALEpg2");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With