Copy Outer Field

Copy a field from another PDF

  1. Create a destination PDF with at least one page.
  2. Bind the destination PDF to the FormEditor facade.
  3. Call copyOuterField(...) with the source document path, field name, target page, and coordinates.
  4. Save the updated destination document.
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();
    }
}