Создание поля TextBox
Contents
[
Hide
]
Используйте FormEditorExamples.createTextBoxField(...), чтобы добавить текстовые поля в форму PDF.
Создание полей TextBox
- Привяжите исходный PDF к фасаду
FormEditor. - Добавьте каждое текстовое поле типа
FieldType.Text, указав имя поля, значение по умолчанию, номер страницы и прямоугольник. - Сохраните обновлённый документ.
public static void createTextBoxField(Path inputFile, Path outputFile) {
FormEditor editor = new FormEditor();
try {
editor.bindPdf(inputFile.toString());
editor.addField(FieldType.Text, "first_name", "Alexander", 1, 50, 570, 150, 590);
editor.addField(FieldType.Text, "last_name", "Smith", 1, 235, 570, 330, 590);
editor.save(outputFile.toString());
} finally {
editor.close();
}
}