إنشاء حقل ListBox

استخدام FormEditorExamples.createListBoxField(...) لإنشاء صندوق قائمة بعناصر محددة مسبقًا.

إنشاء حقل ListBox

  1. اربط ملف PDF المصدر بال واجهة FormEditor.
  2. حدّد عناصر القائمة المتاحة باستخدام setItems(...).
  3. أضف حقل صندوق القائمة مع قيمته الافتراضية والمستطيل.
  4. احفظ المستند المحدث.
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();
    }
}