Sorry, please find the PDF here: https://my.hidrive.com/lnk/WbVpc1Bde

I am using PDFBox 3.0.2.

Best Regards
Martin

Am 06.05.24 um 15:55 schrieb sahy...@fileaffairs.de:
Dear Martin,

Am Montag, dem 06.05.2024 um 15:53 +0200 schrieb Martin Resch:
sorry, PDF attached

could you upload the PDF to a public location as the mailing list
doesn't support attachments.

which version of PDFBox are you using?

BR
Maruan


Martin Resch <re...@lonetech.de> hat am 06.05.2024 15:49 CEST
geschrieben:


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().getF
ield(“Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0]”)).setValu
e(0);
((PDRadioButton)pdfDocument.getDocumentCatalog().getAcroForm().getF
ield(“Formular1[0].Seite1[0].TF_P[0].Optionsfeldliste[0]”)).setValu
e(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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to