外部フィールドのコピー

別の PDF からフィールドのコピー

  1. 少なくとも 1 ページの宛先 PDF を作成してください。
  2. 宛先 PDF を FormEditor ファサードにバインドしてください。
  3. copyOuterField(...) を、ソースドキュメントのパス、フィールド名、対象ページ、座標を引数として呼び出してください。
  4. 更新された宛先ドキュメントを保存してください。
public static void copyOuterField(Path inputFile, Path outputFile) {
    try (Document document = new Document()) {
        document.getPages().add();
        document.save(outputFile.toString());
    }

    FormEditor editor = new FormEditor();
    try {
        editor.bindPdf(outputFile.toString());
        editor.copyOuterField(inputFile.toString(), "First Name", 1, 200, 600);
        editor.save(outputFile.toString());
    } finally {
        editor.close();
    }
}