نسخ الحقل الخارجي

نسخ حقل من 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();
    }
}