Копирование внешнего поля

Копирование поля из другого PDF

  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();
    }
}