As was suggested, use a PdfPCellEvent. The code below should get you most of the way there.
Cell event example. By overriding the cell event, you basically tell iText how you think it should draw its cells. Whenever any cells are added to the table they'll follow your rules.
class CustomCell implements PdfPCellEvent {
public void cellLayout(PdfPCell cell, Rectangle rect,
PdfContentByte[] canvas) {
PdfContentByte cb = canvas[PdfPTable.LINECANVAS];
cb.setLineDash(new float[] {3.0f, 3.0f}, 0);
cb.stroke();
}
}
public class Main {
public static void main(String[] args) throws Exception {
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream("output.pdf"));
document.open();
CustomCell border = new CustomCell();
PdfPTable table = new PdfPTable(6);
PdfPCell cell;
for (int i = 1; i <= 6; i++) {
cell = new PdfPCell(new Phrase("test"));
cell.setCellEvent(border);
table.addCell(cell);
}
document.add(table);
document.close();
}
}