insert header when table split in iTexPdf

2019-08-13 03:22发布

问题:

I'm using iTextPdf 5.4.5. I have a table with many rows in it, and when the table auto-splits to the next page, I want to put header in next page starting of that table. Like suppose i have 5 tables and if table 2 splits then in next page header will say "continue from table 2".

I'm trying to use the PdfPTableEventSplit interface, as follows:

public class PdfTable implements PdfPTableEventSplit
{

@Override
public void splitTable(PdfPTable arg0) {
    System.out.println("split table");

}

@Override
public void tableLayout(PdfPTable arg0, float[][] arg1, float[] arg2, int arg3, int arg4, PdfContentByte[] arg5) {
    System.out.println("table layout");

}

@Override
public void afterSplitTable(PdfPTable arg0, PdfPRow arg1, int arg2) {
    System.out.println("after split");
    arg0.addCell(new Phrase("testing"));
}

But none of the methods is called when table splits.

标签: android itext