[ 
https://issues.apache.org/jira/browse/PDFBOX-6207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18084024#comment-18084024
 ] 

Maruan Sahyoun commented on PDFBOX-6207:
----------------------------------------

Initial analysis

Instead of using an array in the pdf a string is being used for the /Opt entry. 
This is not correct.

{code}
17 0 obj
<<
/FT /Btn
/Kids [61 0 R]
/Opt ()
/T (Checkbox_unten#2)
/TU (Checkbox_unten#2)
/V /Off
>>
endobj
{code}

{quote}
"... If present, the Opt entry shall be an array of text strings representing 
the export value of each annotation in the field. ..."
{quote}

We are handling an empty array but we are currently not handling a
string.


> Setting checkbox value fails when field has an invalid /Opt entry
> -----------------------------------------------------------------
>
>                 Key: PDFBOX-6207
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6207
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: AcroForm
>    Affects Versions: 2.0.36, 3.0.7 PDFBox, 4.0.0
>            Reporter: Maruan Sahyoun
>            Assignee: Maruan Sahyoun
>            Priority: Major
>
> from the users mailing list:
> SUMMARY
> When a checkbox field in an AcroForm PDF contains an empty /Opt array (/Opt 
> []) in its field dictionary, calling PDCheckBox.setValue("Yes") throws an 
> IllegalArgumentException, even though "Yes" is a perfectly valid export value 
> defined by the field's appearance states.
> The same field can be checked and unchecked without any error using Adobe 
> Acrobat products (Acrobat Reader, Acrobat Pro), which treat the empty /Opt 
> array as if it were absent. This confirms that the PDF is valid and the issue 
> is specific to PDFBox's validation logic.
> ERROR MESSAGE
> java.lang.IllegalArgumentException: value 'Yes' is not a valid option for the 
> field Check_Info_Post_andere, valid values are: [] and Off



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to