Create CheckBox Field

Use FormEditorExamples.createCheckBoxField(...) to add a check box field to a PDF form.

Create a check box field

  1. Bind the source PDF to the FormEditor facade.
  2. Add the check box field with FieldType.CheckBox, the field name, caption, page, and rectangle.
  3. Save the updated document.
public static void createCheckBoxField(Path inputFile, Path outputFile) {
    FormEditor editor = new FormEditor();
    try {
        editor.bindPdf(inputFile.toString());
        editor.addField(FieldType.CheckBox, "checkbox1", "Check Box 1", 1, 240, 498, 256, 514);
        editor.save(outputFile.toString());
    } finally {
        editor.close();
    }
}