float[] outer = { 60, 25, 15 };
outertable.setWidths(outer);
LwgPdfPTable innertable = new LwgPdfPTable(2);
float[] inner = {35, 65};
innertable.setWidths(inner);
LwgPdfPCell cell;
TextField text;
innertable.add(new Paragraph("name:", f));
cell = new LwgPdfPCell();
text = new TextField(writer, new LwgRectangle(0, 0), "name");
text.setOptions(TextField.MULTILINE);
text.setFontSize(8);
PdfFormField name = text.getTextField();
cell.setCellEvent(new StudentCardForm(name));
innertable.add(cell);
innertable.add(new Paragraph("date of birth:", f));
cell = new LwgPdfPCell();
text = new TextField(writer, new LwgRectangle(0, 0), "birthday");
text.setOptions(TextField.MULTILINE);
text.setFontSize(8);
PdfFormField birthdate = text.getTextField();
cell.setCellEvent(new StudentCardForm(birthdate));
innertable.add(cell);
innertable.add(new Paragraph("Study Program:", f));
cell = new LwgPdfPCell();
text = new TextField(writer, new LwgRectangle(0, 0), "studyprogram");
text.setOptions(TextField.MULTILINE);
text.setFontSize(8);
PdfFormField studyprogram = text.getTextField();
studyprogram.setFieldName("studyprogram");
cell.setCellEvent(new StudentCardForm(studyprogram));
innertable.add(cell);
innertable.add(new Paragraph("option:", f));
cell = new LwgPdfPCell();
text = new TextField(writer, new LwgRectangle(0, 0), "option");
text.setOptions(TextField.MULTILINE);
text.setFontSize(8);
PdfFormField option = text.getTextField();
option.setFieldName("option");
cell.setCellEvent(new StudentCardForm(option));
innertable.add(cell);
outertable.add(innertable);
cell = new LwgPdfPCell();
cell.setBackgroundColor(new Color(0xFF, 0xDE, 0xAD));
PdfFormField picture = PdfFormField.createPushButton(writer);
picture.setFieldName("picture");
cell.setCellEvent(new StudentCardForm(picture));
outertable.add(cell);
cell = new LwgPdfPCell();
cell.setBackgroundColor(Color.WHITE);
PdfFormField barcode = PdfFormField.createPushButton(writer);
barcode.setFieldName("barcode");
cell.setCellEvent(new StudentCardForm(barcode));
outertable.add(cell);
outertable.writeSelectedRows(0, -1, 20, 100, writer.getDirectContent());
writer.addAnnotation(name);
writer.addAnnotation(birthdate);
writer.addAnnotation(studyprogram);