By Date: <-- -->
By Thread: <-- -->

Setting a radio button programatically with PdfStamper



Birthe Berland wrote:

>I have just one thing that I can't get the hang on: setting the
>value of a radio button or a check button.
>
>I obtain a pdf file from the administration containing form fields.
>The form contains both radio buttons and check buttons.
>If I ask for the field's appearance states I get the following:
>
>Radio button: Yes 0 1
>
>Check button: Yes
>  
>
A Check button with only one possible state?
That's odd...

>It could be that what I think is a check button is really a radio button. 
>Both fields is of type 2.
>
>How do I set the value of these 2 fields?
>

Type 2 fields are check boxes.
See the first comment in this FAQ entry:
http://itext.ugent.be/library/question.php?id=31

I assume that you get the different states for the fields like this:
states = form.getAppearanceStates("myCheckBox");
for (int i = 0; i < states.length; i++)
  System.out.println(states[i]);

In my case, this returns for instance On and Off.
I can then change the state of the checkbox like this:
form.setField("myCheckBox", "On");
or
form.setField("myCheckBox", "Off");

br,
Bruno

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions