テキストボックスフィールドの作成

PDF フォームにテキスト フィールドを追加するには、FormEditorExamples.createTextBoxField(...) を使用してください。

テキストボックスフィールドの作成

  1. ソース PDF を FormEditor ファサードにバインドしてください。
  2. 各テキスト フィールドを追加する際は、FieldType.Text、フィールド名、デフォルト値、ページ番号、および矩形を指定してください。
  3. 更新されたドキュメントを保存してください。
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();
    }
}