[
https://issues.apache.org/jira/browse/PDFBOX-3656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15862421#comment-15862421
]
Tilman Hausherr commented on PDFBOX-3656:
-----------------------------------------
Something else is weird. Try this:
- open the file
- go to page 2, click "Checking"
- save the file
- run this code:
{code}
PDDocument document = PDDocument.load(new File("SF1199AEG (Complete) NEU.pdf"));
System.out.println(document.getDocumentCatalog().getAcroForm().getField("Checking/Savings").getValueAsString());
document.getDocumentCatalog().getAcroForm().getField("Checking/Savings").setValue("2");
{code}
output:
{code}
2
Exception in thread "main" java.lang.IllegalArgumentException: value '2' is not
a valid option for the field Checking/Savings, valid values are: [Savings,
Checking] and Off
at
org.apache.pdfbox.pdmodel.interactive.form.PDButton.checkValue(PDButton.java:346)
at
org.apache.pdfbox.pdmodel.interactive.form.PDButton.setValue(PDButton.java:153)
{code}
> Problem when setting COSName.Off on radio button
> ------------------------------------------------
>
> Key: PDFBOX-3656
> URL: https://issues.apache.org/jira/browse/PDFBOX-3656
> Project: PDFBox
> Issue Type: Bug
> Components: AcroForm
> Affects Versions: 2.0.3, 2.0.4
> Reporter: Scott Coldwell
> Assignee: Maruan Sahyoun
> Fix For: 2.0.5, 2.1.0
>
> Attachments: SF1199AEG (Complete).pdf
>
>
> The following error occurs when trying to set the radio button to COSName.Off
> when the field contains /Opt values:
> {code}
> ERROR (PDFDocument.java:98) - Error populating form us/gov/opm/SF2817
> java.lang.ArrayIndexOutOfBoundsException: -1
> at java.util.ArrayList.elementData(ArrayList.java:418) ~[na:1.8.0_45]
> at java.util.ArrayList.get(ArrayList.java:431) ~[na:1.8.0_45]
> at
> org.apache.pdfbox.pdmodel.common.COSArrayList.get(COSArrayList.java:544)
> ~[pdfbox-2.0.3.jar:2.0.3]
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDButton.constructAppearances(PDButton.java:275)
> ~[pdfbox-2.0.3.jar:2.0.3]
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
> ~[pdfbox-2.0.3.jar:2.0.3]
> at
> org.apache.pdfbox.pdmodel.interactive.form.PDButton.setValue(PDButton.java:167)
> ~[pdfbox-2.0.3.jar:2.0.3]
> {code}
> the code that triggers the error is:
> {code}
> field.setValue(COSName.Off.getName());
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]