You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Damon Li <da...@monadsolutions.com> on 2014/03/04 18:26:40 UTC
Setting value for Checkbox field
Hi all,
I want to set the value for a field which is a checkbox, but the value
does not get set for some reason. I tried the values "true" and "1" yet
it remains unchecked. What value should I be setting checkbox fields as,
and same question for other types such as combo box, radio buttons etc.?
Thanks,
Damon Li
Re: Setting value for Checkbox field
Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi Damon Li,
you could use the check() method. see http://pdfbox.apache.org/docs/1.8.3/javadocs/org/apache/pdfbox/pdmodel/interactive/form/PDCheckbox.html
In addition for setValue you would need to know which value is assigned to the checkbox in order to be treated as true. If you do know the correct value then setValue will also do the job.
BR
Maruan Sahyoun
Am 04.03.2014 um 18:26 schrieb Damon Li <da...@monadsolutions.com>:
> Hi all,
>
> I want to set the value for a field which is a checkbox, but the value does not get set for some reason. I tried the values "true" and "1" yet it remains unchecked. What value should I be setting checkbox fields as, and same question for other types such as combo box, radio buttons etc.?
>
> Thanks,
>
> Damon Li