Decorate Field
Contents
[
Hide
]
Decorate a field
- Bind the source PDF to the
FormEditorfacade. - Configure a
FormFieldFacadewith the required colors and alignment. - Pass the facade to the editor and call
decorateField(...). - Save the updated document.
public static void decorateField(Path inputFile, Path outputFile) {
FormEditor editor = new FormEditor();
try {
editor.bindPdf(inputFile.toString());
FormFieldFacade facade = new FormFieldFacade();
facade.setBackgroundColor(Color.RED);
facade.setTextColor(Color.BLUE);
facade.setBorderColor(Color.GREEN);
facade.setAlignment(FormFieldFacade.ALIGN_CENTER);
editor.setFacade(facade);
editor.decorateField("First Name");
editor.save(outputFile.toString());
} finally {
editor.close();
}
}