Membuat bidang ComboBox

Gunakan FormEditorExamples.createComboBoxField(...) untuk membuat kotak kombo dan menambahkan item yang dapat dipilih.

Membuat bidang combo box

  1. Ikat PDF sumber ke fasad FormEditor.
  2. Tambahkan bidang combo box dengan nilai default dan persegi targetnya.
  3. Tambahkan item combo box yang dapat dipilih.
  4. Simpan dokumen yang telah diperbarui.
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();
    }
}