외부 필드 복사

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