|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Problem with AcroFields and RadioButtonI have a proper pdf document with RadioButtons and TextFields inside. I read this document and extract all AcroFilds. After that i put same data to this AcroFields and stored document in a file. My problem is: all Text Fields are fill in properly but i do not know how put (eg.) 'X' to RadioButton. This RadioButton has four options. I use this code to put same data in to AcroFields:
public void putDataToFields(String file_name) { PdfReader reader = null; HashMap fields = null; try { reader = new PdfReader(acro_in_path + file_name); AcroFields form = reader.getAcroFields(); fields = form.getFields(); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(path + "out_" +file_name)); form = stamper.getAcroFields(); String key; for (Iterator i = fields.keySet().iterator(); i.hasNext();) { key = (String) i.next(); if ("radioButton_name".equalsIgnoreCase(key)) { //this is the place where i want to mark one option for radio button } else form.setField(key, "Some text"); } stamper.setFormFlattening(true); stamper.close(); } catch (IOException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } } I'd like to mark for egzample second option. Could someone halp me ? |
|
|
Re: Problem with AcroFields and RadioButtonprecyz wrote:
> I'd like to mark for egzample second option. Could someone halp me ? At the risk of getting boring: please read chapter 15 of the book. There you'll find what the following example is about: http://www.1t3xt.info/examples/browse/?page=example&id=248 These lines set the value of comboboxes, checkboxes, radiobuttons. form.setField("person.programming", "JAVA"); form.setField("person.language", "FR"); form.setField("person.preferred", "EN"); form.setField("person.knowledge.English", "On"); form.setField("person.knowledge.French", "On"); form.setField("person.knowledge.Dutch", "Off"); And before you say: I've tried that example and "it doesn't work": Check the possible values of the radiobuttons/checkboxes! -- This answer is provided by 1T3XT BVBA ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list iText-questions@... https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar |
| Free Forum Powered by Nabble | Forum Help |