1
votes

I'm using iText in my application.

I'll send an array collection to the iText PDF generator class. That array collection has 10 items, now, I want to display that ten items in a table.

The condition for displaying table is 5 items only has to be displayed per page and remaining should carryforward to next page and display in table.

float[] colsWidth = {0.5f,4f,1.4f,1.4f}; 
PdfPTable itemListTab = new PdfPTable(colsWidth);

Any suggestions?

1

1 Answers

1
votes

While iterating over your array, every fifth element, add your table to the document, start a new page, and create a new table.

if (/* 5 elements */) {
    // add your table to the document
    document.add(itemListTab);

    // create a new page
    document.newPage();

    // create a new table
    itemListTab = new PdfPTable(colsWidth);
}