创建 ListBox 字段
Contents
[
Hide
]
使用 FormEditorExamples.createListBoxField(...) 创建一个带有预定义项的列表框。
创建 list box 字段
- 将源 PDF 绑定到
FormEditor对象。 - 使用以下方式定义可用的列表项
setItems(...)。 - 添加带有默认值和矩形的列表框字段。
- 保存更新后的文档。
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();
}
}