Create ListBox Field
Contents
[
Hide
]
Use FormEditorExamples.createListBoxField(...) to create a list box with predefined items.
Create a list box field
- Bind the source PDF to the
FormEditorfacade. - Define the available list items with
setItems(...). - Add the list box field with its default value and rectangle.
- Save the updated document.
public static void createListBoxField(Path inputFile, Path outputFile) {
FormEditor editor = new FormEditor();
try {
editor.bindPdf(inputFile.toString());
editor.setItems(new String[] {"Australia", "New Zealand", "Malaysia"});
editor.addField(FieldType.ListBox, "listbox1", "Australia", 1, 230, 398, 350, 514);
editor.save(outputFile.toString());
} finally {
editor.close();
}
}