[ https://issues.apache.org/jira/browse/PDFBOX-5831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17870853#comment-17870853 ]
Tilman Hausherr commented on PDFBOX-5831: ----------------------------------------- I'm not Andreas, but commit corrections (svn propset / svn propedit) don't appear in JIRA. I should know because it has happened many, many times to me 😢 and I always ended up entering them manually here. > Radio button can't be set > ------------------------- > > Key: PDFBOX-5831 > URL: https://issues.apache.org/jira/browse/PDFBOX-5831 > Project: PDFBox > Issue Type: Bug > Components: AcroForm > Affects Versions: 3.0.2 PDFBox > Reporter: Tilman Hausherr > Assignee: Maruan Sahyoun > Priority: Major > Labels: Appearance > Fix For: 2.0.33, 3.0.3 PDFBox, 4.0.0 > > Attachments: AU_Erklaerung_final-lower.pdf, > AU_Erklaerung_final-upper.pdf, AU_Erklaerung_final.pdf > > > It is impossible to set the upper radio button with this code, the lower is > set. With "2" also. > {code:java} > String filename = "..../AU_Erklaerung_finalAB.pdf"; > PDDocument pdfDocument = Loader.loadPDF(new File(filename)); > PDAcroForm acroForm = pdfDocument.getDocumentCatalog().getAcroForm(); > acroForm.getField("Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0]").setValue("1"); > pdfDocument.save(filename + System.currentTimeMillis() + ".pdf"); > {code} > Attached: the original file from the user, plus two files where it was set > with Adobe Reader. > What really happens: > The values from the /Opt entry are 1 and 2, the values at the dictionary > level are 0 and 1. Our software somehow gets confused when 1 is used because > it appears in both: when the value "1" is set, then PDButton.updateByOption() > is called twice (!!!), once with value 1 and once with 2. > The same effect happens with {{setValue(0)}} (integer parameter) if we cast > the field to a PDRadioButton. > I changed the PDF so that the /Opt entry has "A" and "B" instead of "1" and > "2" and then it works. (However that can't be changed with Adobe Reader) > The Adobe filled files have 0 and 1 as /V value, we set 1 and 2 as /V value. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org