You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Tilman Hausherr <TH...@t-online.de> on 2017/01/17 18:59:06 UTC

Problem with radioButton.setValue()

Here's code to create radio buttons with appearance streams:
http://stackoverflow.com/a/41632982/535646

When calling

radioButton.setValue("a");

then the first button becomes invisible. That is because

Root/Pages/Kids/[0]/Annots/[0]/AS

has "0" instead of "a" as value, and /V is also "0", /DV is still "b".

Calling

radioButton.setValue("Off");

brings an ArrayIndexOutOfBoundsException.

Is this a bug in our code or a wrong way to create radio buttons?

Tilman


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Problem with radioButton.setValue()

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi,

> Am 17.01.2017 um 19:59 schrieb Tilman Hausherr <TH...@t-online.de>:
> 
> Here's code to create radio buttons with appearance streams:
> http://stackoverflow.com/a/41632982/535646
> 
> When calling
> 
> radioButton.setValue("a");
> 
> then the first button becomes invisible. That is because
> 
> Root/Pages/Kids/[0]/Annots/[0]/AS
> 
> has "0" instead of "a" as value, and /V is also "0", /DV is still "b".


the issue is because of the /Opt entry (which is not neccesary in this case). This is used to look up the index of the value and the index will then be used for the value.

> 
> Calling
> 
> radioButton.setValue("Off");
> 
> brings an ArrayIndexOutOfBoundsException.

this should not happen of course but again caused by the /Opt entry and the handling of that.

BR
Maruan

> 
> Is this a bug in our code or a wrong way to create radio buttons?
> 
> Tilman
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org