// step 4
float[] columnDefinitionSize = { 33.33F, 33.33F, 33.33F };
float pos = height / 2;
LwgPdfPTable table = null;
LwgPdfPCell cell = null;
table = new LwgPdfPTable(columnDefinitionSize);
table.getDefaultCell().setBorder(0);
table.setHorizontalAlignment(0);
table.setTotalWidth(width - 72);
table.setLockedWidth(true);
cell = new LwgPdfPCell(new LwgPhrase("Table added with document.add()"));
cell.setColspan(columnDefinitionSize.length);
table.add(cell);
table.add(new LwgPhrase("Louis Pasteur", font8));
table.add(new LwgPhrase("Albert Einstein", font8));
table.add(new LwgPhrase("Isaac Newton", font8));
table.add(new LwgPhrase("8, Rabic street", font8));
table.add(new LwgPhrase("2 Photons Avenue", font8));
table.add(new LwgPhrase("32 Gravitation Court", font8));
table.add(new LwgPhrase("39100 Dole France", font8));
table.add(new LwgPhrase("12345 Ulm Germany", font8));
table.add(new LwgPhrase("45789 Cambridge England", font8));
document.add(table);
table = new LwgPdfPTable(columnDefinitionSize);
table.getDefaultCell().setBorder(0);
table.setHorizontalAlignment(0);
table.setTotalWidth(width - 72);
table.setLockedWidth(true);
cell = new LwgPdfPCell(new LwgPhrase("Table added with writeSelectedRows"));
cell.setColspan(columnDefinitionSize.length);
table.add(cell);
table.add(new LwgPhrase("Louis Pasteur", font8));
table.add(new LwgPhrase("Albert Einstein", font8));
table.add(new LwgPhrase("Isaac Newton", font8));
table.add(new LwgPhrase("8, Rabic street", font8));
table.add(new LwgPhrase("2 Photons Avenue", font8));
table.add(new LwgPhrase("32 Gravitation Court", font8));
table.add(new LwgPhrase("39100 Dole France", font8));
table.add(new LwgPhrase("12345 Ulm Germany", font8));
table.add(new LwgPhrase("45789 Cambridge England", font8));
table.writeSelectedRows(0, -1, 50, pos, writer.getDirectContent());
}
catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {