Hi, I am reading a PDF, want to set one of the radio buttons included in the PDF and save the PDF in a new file.
My PDF has a group of two radio buttons included. The field name is Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0] Valid values are:[1, 2] and Off This is my code: String filename = "AU_Erklaerung_final.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”); // acroForm.getField("Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0]").setValue("2");// ((PDRadioButton) acroForm.getField("Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0]")).setValue(0);// ((PDRadioButton) acroForm.getField("Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0]")).setValue(1); pdfDocument.save(filename + System.currentTimeMillis() + “.pdf”); I have tried: pdfDocument.getDocumentCatalog().getAcroForm().getField(“Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0]”).setValue(“1”); pdfDocument.getDocumentCatalog().getAcroForm().getField(“Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0]”).setValue(“2”); // and ((PDRadioButton)pdfDocument.getDocumentCatalog().getAcroForm().getField(“Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0]”)).setValue(0); ((PDRadioButton)pdfDocument.getDocumentCatalog().getAcroForm().getField(“Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0]”)).setValue(1); Regardless which value I set (either via string or int), it is always the same radio buttion select in my PDF (the lower one). Can anybody support? Thanks a lot in advance! Best regards Martin --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org