Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.2 PDFBox
Description
It is impossible to set the upper radio button with this code, the lower is set. With "2" also.
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");
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.
Attachments
Attachments
Issue Links
- links to