Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Repeat PdfPTable header in all the continuation pages using iText

Tags:

java

itext

How can I repeat the headings of a PdfPTable in all the pages if the length of the table exceeds one page?

like image 422
SKK Avatar asked Aug 08 '12 08:08

SKK


People also ask

How do I repeat headers in PDF?

To repeat the PdfGrid headers in all the pages of PDF document, we can add the headers using PdfGridHeaderCollection class and enable the RepeatHeader property to repeat header in grid table.

How do I add a footer to a PDF in Java?

In order to add text in the footer, you need to create a Document object and a TextStamp object using required properties. After that, you can call AddStamp method of the Page to add the text in the footer of the PDF. The following code snippet shows you how to add text in the footer of a PDF file with Java.


1 Answers

Look at setHeaderRows(int headerRows) of PdfPTable. Rows defined there as a header should persist on new pages.

table.setHeaderRows(1)

for the first row as a header.

See the API.

like image 64
Blacklight Avatar answered Oct 29 '22 16:10

Blacklight