You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "twopals@juno.com" <tw...@juno.com> on 2014/10/24 21:43:05 UTC

Populating single value radio buttons causes error

 Question regarding populating fields with PDFbox (specifically a push button field)is there an issue/bug populating a single value push button field with PDFbox?  I have a formthat has fields that are push buttons (single option radio button)my code updates the text fields and check boxes on the form, however the singlevalue radio type buttons it encounters an error.  The field has a default "on value" for exampleof "Y", I try to populate that field with a "Y" using field.setValue(string) and I get an error. ERROR assigning value to field: java.lang.NullPointerException is there a alternate way to handle these type of fields?  PDDocumentCatalog docCatalog =pd.getDocumentCatalog();PDAcroForm acroForm = docCatalog.getAcroForm();System.out.println("Try to set field: " + flds[1]);PDField field = acroForm.getField(flds[1]);if (field != null) { System.out.println(" has field, now update it");try {field.setValue(flds[2]);System.out.println(" set field: " + flds[1] + " to value: " + flds[2]);}catch(Exception e) {System.out.println(" ERROR assigning value to field");} }else {System.out.println(" *No field found with name:" + flds[1]);System.err.println(" *No field found with name:" + flds[1]);}}

____________________________________________________________
Fast, Secure, NetZero 4G Mobile Broadband. Try it.
http://www.netzero.net/?refcd=NZINTISP0512T4GOUT2