Создание поля ComboBox

Используйте FormEditorExamples.createComboBoxField(...), чтобы создать комбобокс и добавить выбираемые элементы.

Создание поля combo box

  1. Привяжите исходный PDF к фасаду FormEditor.
  2. Добавьте поле combo box с его значением по умолчанию и целевым прямоугольником.
  3. Добавьте выбираемые элементы combo box.
  4. Сохраните обновлённый документ.
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();
    }
}