Copier un champ depuis un autre PDF
Contents
[
Hide
]
Copier un champ d’un autre PDF
-
Créez un PDF de destination avec au moins une page.
-
Liez le PDF de destination à la façade
FormEditor. -
Appelez
copyOuterField(...)avec le chemin du document source, le nom du champ, la page cible et les coordonnées. -
Enregistrez le document de destination mis à jour.
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();
}
}