You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Mark Melling (JIRA)" <ji...@apache.org> on 2016/06/30 07:57:10 UTC

[jira] [Created] (PDFBOX-3406) Problems setting "on values" for PDCheckBox

Mark Melling created PDFBOX-3406:
------------------------------------

             Summary: Problems setting "on values" for PDCheckBox
                 Key: PDFBOX-3406
                 URL: https://issues.apache.org/jira/browse/PDFBOX-3406
             Project: PDFBox
          Issue Type: Bug
          Components: AcroForm
    Affects Versions: 2.1.0
            Reporter: Mark Melling


I'm not entirely sure if this is a bug or I'm doing something incorrectly.

I'm trying to create a PDCheckBox, which I can then subsequently call check() on, but when I create a "vanilla" PDCheckBox and then call check() on it I get the error:

IllegalArgumentException value 'Yes' is not a valid option for the field initial-assessment, valid values are: [] and Off

I then tried to use setExportValues() as looking at the code it looked like this would do the trick. Unfortunately checkValue() which is called at the start of setValue() fails, as whilst the PDButton version of getOnValues checks if their are any export values, the PDCheckBox version doesn't and for this reason fails. 

I then tried to create a dictionary of values by using setNormalAppearance on the PDAppearanceDictionary of the CheckBox's widget. In the dictionary I just created an entry using setName ("Yes", ""). Initially this didn't work as getSubDirectory of PDAppearanceEntry filters out any entries that don't have a value which is an instance of COSStream. I resolved this by simply creating a empty COSStream value, but this didn't feel right, particularly given that the value is not even used in this context (if I understand the code correctly).

Given all of this I suspect I'm doing this all wrong, but it's not clear what the right way to do it is.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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