Anshul
Anshul

Reputation: 645

Set the header for PDF document on second page


I have a jsp page that contains some data(This data may very because it is fetches from the data base) over it.Now I am generating the PDF file for the my jsp page using the ‘Itext api’ . Now I need to set the some specific header on this generated pages started from the Page 2 onwards.
For Ex :-

Test.jsp

Jsp test page contains the data for testing purpose.

Test.pdf

    Jsp test page contains the data for testing purpose.
    ……
    …

Page 1 ends
Page 2 starts

My title for the page..(Only needed for the second page onwards)**

Please help me...

Thanks in advance

Upvotes: 0

Views: 884

Answers (1)

Jandyco
Jandyco

Reputation: 21

You can probably make use of setSkipFirstHeader(boolean) of PdfPTable. Which will not print out the first occurrence of the header of your table. You will need to be sure to setHeaderRows on the table.

You could also subclass the PdfPageEventHelper and in the onEndPage event, use the passed in Document object to getPageNumber(). When you determine it is past the first page, you can add your header content to the document.

Upvotes: 2

Related Questions