The issue seems to have been related to the fact that the export values were in Hebrew. When I changed them to English the setValue method worked...
On Thu, Nov 23, 2017 at 11:58 AM, Gilad Denneboom <[email protected] > wrote: > I have a similar issue but no matter what I do I can't get it to work... > I'm looking at the Options array for the new value and setting the matching > widget, or at least I'm trying to. Any suggestions on how to do it (using > 1.8.13)? > Here's my code: > > PDCheckbox checkBox = (PDCheckbox) f; > checkBox.getDictionary().setName("V", newValue); > List<String> options = checkBox.getOptions(); > for (int i=0; i<options.size(); i++) { > if (options.get(i).equals(newValue)) { > checkBox.getWidgets().get(i). > getDictionary().setName(COSName.getPDFName("AS"), newValue); > } else checkBox.getWidgets().get(i). > getDictionary().setItem(COSName.getPDFName("AS"), > COSName.getPDFName("Off")); > } > > > On Wed, Sep 9, 2015 at 8:22 AM, Maruan Sahyoun <[email protected]> > wrote: > >> Hi, >> >> > Am 08.09.2015 um 21:00 schrieb Bart Taylor <[email protected]>: >> > >> > Hi Maruan, >> > >> > Thank you for the speedy fix. I built the 1.8 branch and verified that >> > check() method works in both single and duplicate field cases. >> getOnValue() >> > also does not return a null pointer exception after the patch. >> >> you're welcome - thanks for testing the fix so quickly. >> Maruan >> >> > >> > Thanks again, >> > Bart. >> > >> > On Tue, Sep 8, 2015 at 10:15 AM, Bart Taylor <[email protected]> wrote: >> > >> >> Hi Maruan, >> >> >> >> I was able to verify that the latest trunk snapshot does correct the >> >> issue. >> >> >> >> I used the latest 1.8.11 snapshot to test the getWidgets() method and >> set >> >> the AppearanceStream for each widget, and that also works as long as I >> know >> >> the exact value to use. Calling the getOnValue() method for the field >> >> throws a Null Pointer Exception in PDCheckbox.java at line 140: >> >> >> >> COSBase n = ap.getDictionaryObject(COSName.getPDFName("N")); >> >> I did not get your response emails, so I cannot reply to the last one >> in >> >> the chain. >> >> >> >> Thanks for your help, >> >> Bart. >> >> >> >> On Fri, Sep 4, 2015 at 2:50 PM, Bart Taylor <[email protected]> wrote: >> >> >> >>> Hi, >> >>> >> >>> I have a simple document with two PDCheckbox fields, and one of those >> >>> fields has two AnnotationWidgets. I am able to successfully call >> check() on >> >>> the first field and see the result in the output document, but calling >> >>> check() on the field with multiple AnnotationWidgets has no effect. >> >>> >> >>> My understanding of duplicated fields is that only a single PDField >> >>> exists but that an AnnotationWidget kid will exist for each instance >> of the >> >>> field in the document, so setting the PDField parent once should >> affect all >> >>> of the children. Am I misunderstanding how this should work? >> >>> >> >>> Attached is the document I am testing as well as a small Java class >> that >> >>> reproduces the issue by calling check() on everything in >> getFields(). I >> >>> have tried this with PDFBox 1.8.9, 1.8.10, and the 09/03 Snapshot of >> 2.0.0. >> >>> I am viewing the document with Adobe Acrobat Reader DC Version >> >>> 2015.008.20082. >> >>> >> >>> Any insight would be appreciated. >> >>> >> >>> Thanks, >> >>> Bart. >> >>> >> >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> >

