How to write page titles when using iText library in java

I am developing a reporting application that can have tabular data on several pages. I use pdfTable to create tabular data. I'm having problems adding page headers. The problem is that when I add the title header to the onEndPage event handler, I don't get the table to start after a certain break so that the title is visible.

+4
source share
2 answers

If you use tables (PDFPTable) for your layout, you can use: table.setHeaderRows (2);

JavaDoc Link: http://api.itextpdf.com/com/itextpdf/text/pdf/PdfPTable.html

0
source

If I understand this correctly, you just need to change your fields so that the table starts after the header.

From http://www.docjar.org/docs/api/com/lowagie/text/Document.html

public Document(Rectangle pageSize, float marginLeft, float marginRight, float marginTop, float marginBottom) 

For instance:

 final Document document = new Document(PageSize.A4, 50, 50, 165, 50); 
+4
source

Source: https://habr.com/ru/post/1285902/


All Articles