Affects Version/s: 2.0.16
Fix Version/s: None
Hello, thank you for all of your efforts in building and maintaining PDFBox. We use it extensively for parsing PDFs, programmatically setting values and flattening PDFs for print.
BUG: When we parse the attached PDF, the onvalues for the radio buttons are 0, 1, 2, 3, 4, which are determined by PDButton.getOnValueForWidget. Later on, when we try to programmatically set the value of the radio buttons (PDField.setValue) using the above onvalues, we receive this error:
The radio buttons all have the same name, with either "Choice2" or "0" as the choice value. We would expect it to behave like Adobe DC, which allows the user to select any of the buttons regardless of whether they have the same choice or not. I am on PDFBox 2.0.16.
Though my example might seem trivial, it's very easy for our PDF creating users to do this because copying and pasting fields is the easiest way to build a PDF.
This might be a regression caused by
PDFBOX-3391. In our code, we have overridden the PDButton.setValue method so that it always invokes updateByValue(value) rather than sometimes using updateByOption(value). Here is the code that works for us, from PDButton.setValue(String value):
One caveat is that the change would probably break your
PDFBOX-3391 fix, but perhaps there's some way to have them live side by side. I don't know very much about the other problem.