this will not work in this case as you already found. To get a list of
possible values to switch the checkbox to the "ON" state you can use 

        checkbox.getOnValues()

BR
Maruan

Am Donnerstag, dem 02.05.2024 um 16:20 +0200 schrieb Ulf Dittmer:
> Thanks, I will give that a try. So far, I had used the code from the
> SetField example, which does this (and failed in this case):
> 
>               PDCheckBox checkbox = (PDCheckBox) field;
>                 if (value.isEmpty())
>                 {
>                     checkbox.unCheck();
>                 }
>                 else
>                 {
>                     checkbox.check();
>                 }
> 
> On Thu, May 2, 2024 at 3:17 PM sahy...@fileaffairs.de <
> sahy...@fileaffairs.de> wrote:
> 
> > 
> > 
> > Am Donnerstag, dem 02.05.2024 um 12:56 +0200 schrieb Ulf Dittmer:
> > > Oh, so the PDF is sort of broken? The doc info says it was
> > > created
> > > using
> > > Adobe's PDF library using Adobe InDesign :-)
> > > 
> > 
> > Hi,
> > 
> > you can use it like this:
> > 
> > PDCheckBox field = (PDCheckBox)
> > acroForm.getField("chbx_46_Arbeitsentgelt");
> > field.setValue("pro Stunde");
> > testPdf.save("proStunde.pdf");
> > field.setValue("pro Monat");
> > testPdf.save("proMonat.pdf");
> > 
> > BR
> > Maruan
> > 
> > > Ulf
> > > 
> > > On Thu, May 2, 2024 at 12:51 PM Tilman Hausherr
> > > <thaush...@t-online.de>
> > > wrote:
> > > 
> > > > It's a radio button but without the radio flag?!
> > > > 
> > > > Tilman
> > > > 
> > > > On 02.05.2024 12:42, Ulf Dittmer wrote:
> > > > > Yes, that's the one for the "pro Stunde" option. But the one
> > > > > for
> > > > > the "pro
> > > > > Monat" option is missing.
> > > > > 
> > > > > They're both connected, in that checking one manually will
> > > > > uncheck the
> > > > > other. But setting *any* value programmatically only causes
> > > > > the
> > > > > first one
> > > > > to be set.
> > > > > 
> > > > > Ulf
> > > > > 
> > > > > On Thu, May 2, 2024 at 12:38 PM sahy...@fileaffairs.de <
> > > > > sahy...@fileaffairs.de> wrote:
> > > > > 
> > > > > > That's chbx_46_Arbeitsentgelt
> > > > > > 
> > > > > > BR
> > > > > > Maruan
> > > > > > 
> > > > > > Am Donnerstag, dem 02.05.2024 um 12:15 +0200 schrieb Ulf
> > > > > > Dittmer:
> > > > > > > Sorry, I didn't realize that. It's a form from a German
> > > > > > > government
> > > > > > > agency,
> > > > > > > and can be found at
> > > > > > > 
> > > > > > > 
> > > > > > 
> > > > 
> > https://www.arbeitsagentur.de/datei/erklaerung-zum-beschaeftigungsverhaeltnis_ba047549.pdf
> > > > > > > Ulf
> > > > > > > 
> > > > > > > On Thu, May 2, 2024 at 12:05 PM sahy...@fileaffairs.de <
> > > > > > > sahy...@fileaffairs.de> wrote:
> > > > > > > 
> > > > > > > > Hi,
> > > > > > > > 
> > > > > > > > can you upload the PDF in question to a public location
> > > > > > > > to
> > > > > > > > take a
> > > > > > > > view.
> > > > > > > > Attachments won't work for the mailing list.
> > > > > > > > 
> > > > > > > > BR
> > > > > > > > Maruan
> > > > > > > > 
> > > > > > > > Am Donnerstag, dem 02.05.2024 um 12:01 +0200 schrieb
> > > > > > > > Ulf
> > > > > > > > Dittmer:
> > > > > > > > > Hi-
> > > > > > > > > 
> > > > > > > > > I'm running the PrintFields example code
> > > > > > > > > (
> > > > > > > > > 
> > https://svn.apache.org/repos/asf/pdfbox/trunk/examples/src/main/ja
> > > > > > > > > va
> > > > > > > > > /org/apache/pdfbox/examples/interactive/form/PrintFie
> > > > > > > > > lds.
> > > > > > > > > java) to
> > > > > > > > > find all the form field names for a PDF, but it's
> > > > > > > > > missing
> > > > > > > > > a
> > > > > > > > > checkbox
> > > > > > > > > that I'd need to set.
> > > > > > > > > 
> > > > > > > > > The checkbox in question is on page 5, no. 46 "pro
> > > > > > > > > Monat". The
> > > > > > > > > "pro
> > > > > > > > > Stunde" checkbox is there, as are the two text
> > > > > > > > > fields.
> > > > > > > > > 
> > > > > > > > > The relevant output of PrintFields is
> > > > > > > > > 
> > > > > > > > > txtf_46_Entgelt_pro_Stunde
> > > > > > > > > > --
> > > > > > > > > > txtf_46_Entgelt_pro_Stunde.txtf_46_Entgelt_pro_Stun
> > > > > > > > > > de
> > > > > > > > > > = ,
> > > > > > > > > 
> > > > > > > > > type=org.apache.pdfbox.pdmodel.interactive.form.PDTex
> > > > > > > > > tFie
> > > > > > > > > ld
> > > > > > > > >   alternate name=46 - Höhe und Berechnungsart des
> > > > > > > > > Arbeitsentgelts
> > > > > > > > > -
> > > > > > > > > Entgelt pro Stunde (brutto in Euro), mapping
> > > > > > > > > name=null
> > > > > > > > > flags=8388608, isNoExport=false, isReadOnly=false,
> > > > > > > > > isRequired=false
> > > > > > > > > chbx_46_Arbeitsentgelt
> > > > > > > > > > --chbx_46_Arbeitsentgelt.chbx_46_Arbeitsentgelt =
> > > > > > > > > > Off,
> > > > > > > > > 
> > > > > > > > > type=org.apache.pdfbox.pdmodel.interactive.form.PDChe
> > > > > > > > > ckBo
> > > > > > > > > x
> > > > > > > > >   alternate name=46 - Höhe und Berechnungsart des
> > > > > > > > > Arbeitsentgelts,
> > > > > > > > > mapping name=null
> > > > > > > > > flags=0, isNoExport=false, isReadOnly=false,
> > > > > > > > > isRequired=false
> > > > > > > > > txtf_46_Entgelt_pro_Monat
> > > > > > > > > > --
> > > > > > > > > > txtf_46_Entgelt_pro_Monat.txtf_46_Entgelt_pro_Monat
> > > > > > > > > > =
> > > > > > > > > > ,
> > > > > > > > > 
> > > > > > > > > type=org.apache.pdfbox.pdmodel.interactive.form.PDTex
> > > > > > > > > tFie
> > > > > > > > > ld
> > > > > > > > >   alternate name=46 - Höhe und Berechnungsart des
> > > > > > > > > Arbeitsentgelts
> > > > > > > > > -
> > > > > > > > > Entgelt pro Monat (brutto in Euro), mapping name=null
> > > > > > > > > flags=8388608, isNoExport=false, isReadOnly=false,
> > > > > > > > > isRequired=false
> > > > > > > > > 
> > > > > > > > > Is the PDF broken in some way, or am I missing
> > > > > > > > > something?
> > > > > > > > > 
> > > > > > > > > Let me know if I can supply any further information.
> > > > > > > > > I'd
> > > > > > > > > be
> > > > > > > > > thankful
> > > > > > > > > for any additional information.
> > > > > > > > > 
> > > > > > > > > Ulf
> > > > > > > > > 
> > > > > > > > > -----------------------------------------------------
> > > > > > > > > ----
> > > > > > > > > --------
> > > > > > > > > ----
> > > > > > > > > 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
> > > > 
> > > > 
> > 
> > 
> > -------------------------------------------------------------------
> > --
> > 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