【问题标题】:Add header using iTextSharp depending on page content [duplicate]根据页面内容使用 iTextSharp 添加标题 [重复]
【发布时间】:2016-07-05 04:30:19
【问题描述】:

我正在使用 iTextSharp 5.5.9 生成 PDF。 PDF 将包含各种图像和表格。前几页(0 个或更多)中会有图像,然后是一个可能跨越多个页面的表格。

考虑以下测试代码:

PdfPTable table = new PdfPTable(columnsCount);
table.HeaderRows = 1;

// Call AddCell columnsCount number of times to have the header row

for (int i = 0; i < 200; i++)
    table.AddCell(new Phrase(i.ToString()));

上面的代码将跨越多个页面的表格。可能还有其他页面不会出现此表。

我只需要在table 将出现的页面中设置带有特定文本的标题。

我该怎么做?

【问题讨论】:

    标签: c# pdf pdf-generation itext


    【解决方案1】:

    [已经回答]

    哦,我只是将could pass parameter 转换为PdfPageEventHelper 的子类。

    【讨论】:

    • 当您确定您的问题重复时,我将其标记为重复。
    猜你喜欢
    • 1970-01-01
    • 2012-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-05
    相关资源
    最近更新 更多