'How to check checkbox a pdf editor form using C#
This is my last hope please help me I am stuck with that check box in pdf editor. I'm using iText library to generate pdf file based on template. But when I try to set checkbox field it won't filled. My code is below
form.SetField("topmostSubform[0].Page1[0].c1_01_0_[0]","1");
form.SetField("topmostSubform[0].Page1[0].c1_03_0_[0]", "true");
form.SetField("topmostSubform[0].Page1[0].c1_02_0_[0]", "2");
form.SetField("topmostSubform[0].Page1[0].c1_04_0_[0]", "On");
I have tried with following values
1) "Yes"
2) "1"
3) "true"
4) "On"
5) "2"
some one suggest me pass this value. I tried but this one also not working in my code.
Which value should I pass to set check box. Please help me and I referred this link also but it is not working.
Solution 1:[1]
The way you are setting the value is fine, but the value you are going to set should be matched with the Export Value
Q: how to find export value
Ans: If you can open the pdf in the Acrobat or any other pdf designer/editor You can find its value by right click property ... Export Value
If Export Value is Y just set the value like
form.SetField("topmostSubform[0].Page1[0].c1_01_0_[0]","Y");
Solution 2:[2]
You already use 'Yes' for checkbox. I also filled pdf using ItextShap.
As per my knowledge, If you pass 'Yes' then it will check, you pass nothing then It will uncheck. Do one thing, Please share file with me.I will check in my code, after I will tell, what is the problem exactly.
Thanks .
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Imran Muhammad |
Solution 2 | Ronak Patel |