Create RadioButton Field
Contents
[
Hide
]
Use FormEditorExamples.createRadioButtonField(...) to create a radio button field with predefined options.
Create a radio button field
- Bind the source PDF to the
FormEditorfacade. - Configure the radio button gap, orientation, and item size.
- Define the radio button items.
- Add the radio button field with its default selection and rectangle.
- Save the updated document.
public static void createRadioButtonField(Path inputFile, Path outputFile) {
FormEditor editor = new FormEditor();
try {
editor.bindPdf(inputFile.toString());
editor.setRadioGap(4);
editor.setRadioHoriz(false);
editor.setRadioButtonItemSize(20);
editor.setItems(new String[] {"Australia", "New Zealand", "Malaysia"});
editor.addField(FieldType.Radio, "radiobutton1", "Malaysia", 1, 240, 498, 256, 514);
editor.save(outputFile.toString());
} finally {
editor.close();
}
}