Mega Code Archive
Big Table With Header Rows
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
public class BigTableWithHeaderRowsPDF {
public static void main(String[] args) {
Document document = new Document(PageSize.A4.rotate(), 10, 10, 10, 10);
try {
PdfWriter.getInstance(document, new FileOutputStream("BigTableWithHeaderRowsPDF.pdf"));
document.open();
int NumColumns = 12;
PdfPTable datatable = new PdfPTable(NumColumns);
int headerwidths[] = { 9, 4, 8, 10, 8, 11, 9, 7, 9, 10, 4, 10 }; // percentage
datatable.setWidths(headerwidths);
for(int i=0;i