1.iText输出table使用PDFPTable类。代码如下:
Document document = new Document(PageSize.A4);
try{
PdfWriter writer = PdfWriter.getInstance(document,
new FileOutputStream("H:\\workspace\\PdfDemo\\iText2.pdf"));
document.open();
document.addTitle("第2个pdf文档");
PdfPTable table = new PdfPTable(3);
for(int i = 0 ;i< 9;i++){
PdfPCell cell = new PdfPCell();
cell.addElement(new Paragraph("cell "+1));
table.addCell(cell);
}
document.add(table);
document.close();
}catch(Exception e){
e.printStackTrace();
}