首页 文章

使用java,Itext生成pdf文件

提问于
浏览
0

我的要求是生成pdf,其中如果数据更多而不是在新页面中创建整个数据,则应该在页面之间分割从数据库检索的数据 .

例如,有时当一个表必须在另一个页面上拆分时,拆分行的一些单元格应出现在前一页面上,而其他单元格出现在下一页面上 .

请帮助解决这个问题 .

4 回答

  • 0

    你考虑过iReport吗?

  • 0

    也许你应该考虑看Jasper Reports

  • 0

    PdfPTable跨页面分裂 . 构建其中之一相当容易 .

    缺点是根据您的特定需求设置表格可能会很麻烦 . 您可能需要为它编写一些抽象 .

    获得文档后,添加表格/单元格就像以下一样简单:

    Document document = // some document
    PdfPTable table = new PdfPTable(columns);
    table.addCell(new PdfPCell("data goes here));
    
  • 0

    如果您在 Java 中使用手动 iText 编码,我认为您将需要:

    PdfPTable table; // your table
    
    table.setKeepTogether(false); // allows table to split table
    table.setHeaderRows(1);       // rows of header
    table.setFooterRows(2);       // rows of footer
    

    有关表check iText official websitefooters and headers的更多信息和示例 .

相关问题