I need to create a PDF Document using Java's iText libraries. I need to include as well some checkboxes, which are on/off depending on the value of some class variables. I've found some examples about interactive forms but I don't need this level of complexity: just some checkboxes which are added to a basic document like this:
public class SamplePDF {
public static final String RESULT = "hello.pdf";
public static void main(String[] args)
throws DocumentException, IOException {
new SamplePDF().createPdf(RESULT);
}
public void createPdf(String filename)
throws DocumentException, IOException {
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(filename));
document.open();
document.add(new Paragraph("Document Heading"));
//
// Add Checkboxes here
//
document.close();
}
}
Any help ?