0

I have a PDFPTable that may span over multiple pages. The table should have the same first/header row on every page.

How can I do so?

It seems that since I can't give rows explicitly (which PDFPCells form a row is decided by how many cells have been added before), I have to manually calculate which row would be the first to be displayed on the next page. Is this correct?

How can I calculate that?

Alexander
  • 19,906
  • 19
  • 75
  • 162

2 Answers2

1

It is really easy to do once you know how. You just have to add the line

table.setHeaderRows(1)

as per the iText documentation, and the first table row is used as the header row across all pages.

Alexander
  • 19,906
  • 19
  • 75
  • 162
0

Header has nothing to do with the Row calculation of the Table which you want to display in the PDF. Add Code for header which contains header or First Row (I think with this you meant the Column names of the Table that you want to display on the PDF). This will automatically appear on all PDF page and subsequent to which will be your table data in continuity.

Here is SO link to add header and footer using ITEXTSHARP Add Header

Syntax may differ a little as its in C#.

Community
  • 1
  • 1
Lara
  • 2,821
  • 7
  • 39
  • 72