Create ComboBox Field
Contents
[
Hide
]
Use FormEditorExamples.createComboBoxField(...) to create a combo box and add selectable items.
Create a combo box field
- Bind the source PDF to the
FormEditorfacade. - Add the combo box field with its default value and target rectangle.
- Add the selectable combo box items.
- Save the updated document.
public static void createComboBoxField(Path inputFile, Path outputFile) {
FormEditor editor = new FormEditor();
try {
editor.bindPdf(inputFile.toString());
editor.addField(FieldType.ComboBox, "combobox1", "Australia", 1, 230, 498, 350, 514);
editor.addListItem("combobox1", new String[] {"Australia", "Australia"});
editor.addListItem("combobox1", new String[] {"New Zealand", "New Zealand"});
editor.save(outputFile.toString());
} finally {
editor.close();
}
}