I am developing a report generation application that could have tabular data across multiple pages. I am using pdfTable to create tabular data. I am issues with adding page headers. The problem is that when I add page header onEndPage event handler, I am not get the table to start after certain gap so that header is visible.
我正在开发一个报表生成应用程序,可以在多个页面上显示表格数据。我正在使用pdfTable来创建表格数据。我是添加页眉的问题。问题是,当我在onEndPage事件处理程序中添加页眉时,我没有让表在某个间隙后启动,以便标题可见。
2 个解决方案
#1
If you are using tables (PDFPTable) for your layout then you can use: table.setHeaderRows(2);
如果您使用表(PDFPTable)作为布局,那么您可以使用:table.setHeaderRows(2);
JavaDoc Link : http://api.itextpdf.com/com/itextpdf/text/pdf/PdfPTable.html
JavaDoc链接:http://api.itextpdf.com/com/itextpdf/text/pdf/PdfPTable.html
#2
If I understand this correctly, you just need to change your margins, so table will start after 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 example:
final Document document = new Document(PageSize.A4, 50, 50, 165, 50);
#1
If you are using tables (PDFPTable) for your layout then you can use: table.setHeaderRows(2);
如果您使用表(PDFPTable)作为布局,那么您可以使用:table.setHeaderRows(2);
JavaDoc Link : http://api.itextpdf.com/com/itextpdf/text/pdf/PdfPTable.html
JavaDoc链接:http://api.itextpdf.com/com/itextpdf/text/pdf/PdfPTable.html
#2
If I understand this correctly, you just need to change your margins, so table will start after 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 example:
final Document document = new Document(PageSize.A4, 50, 50, 165, 50);