Dear Paulo,
I want to set an editable combo box with a value other
than the ChoiceExports.
I wish that when the pdf is open, the combo box shows
the text that is my typed text.
I use setValueAsName and setText. But, it doesn't
work. Please help.
Thanks,
yun wang
here is my code:
Document document = new Document(PageSize.A4, 50, 50,
50, 50);
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("test.pdf"));
document.open();
PdfFormField topField =
PdfFormField.createCombo(writer, true, new
String[][]{{"value1", "First"},{"value2", "Second"}},
0);
topField.setFieldName("Combo");
// topField.setValueAsName("my typed alue"); //crash
adobe reader
TextField app = new TextField(writer, new
Rectangle(250, 700, 250 + 100, 700 + 20), null);
app.setChoices(new String[]{"First", "Second"});
app.setChoiceExports(new String[]{"value1",
"value2"});
app.setText("my typed value"); //don't work
PdfFormField fieldKid = app.getComboField();
topField.addKid(fieldKid);
app.setBox(new Rectangle(250, 600, 250 + 100, 600 +
20));
PdfFormField fieldKid2 = app.getComboField();
topField.addKid(fieldKid2);
writer.addAnnotation(topField);
document.close();
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions