【问题标题】:iText flying-saucer page footer shows only on last pageiText 飞碟页脚仅显示在最后一页
【发布时间】:2013-11-18 07:12:30
【问题描述】:

我有 html 和 css 用于构建我的 iText 飞碟页面,设置如下...

<html>
    <head>
        <style type="text/css">
            body { padding: 5px; }

            .footer {
                position: running(footer);
                font-size: 11px;
                text-align: center;
            }

            @page {
                @bottom-center {
                    content: element(footer)
                }
            }

            .pagenumber:before {
                content: counter(page)
            }

            .pagecount:before {
                content: counter(pages)
            }
        </style>
    </head>
    <body>
        <div class="content">
            lots of content that spans multiple pages in here...
        </div>
        <div class="footer">
            Page <span class="pagenumber"></span> of <span class="pagecount"></span>
        </div>
    </body>
</html>

为什么页脚只显示在最后一页?

【问题讨论】:

    标签: html css itext flying-saucer


    【解决方案1】:

    当“内容”小到可以放在一页上时,页脚会在该页上正常显示。一旦“内容”跨越多个页面,页脚将仅显示在最后一页上。

    原来我需要在内容之前放置页脚,以便它显示在每个页面上...

    <div class="footer">
        Page <span class="pagenumber"></span> of <span class="pagecount"></span>
    </div>
    <div class="content">
        lots of content that spans multiple pages in here...
    </div>
    

    如果涉及标题,看起来也是一样的……它们应该在页面内容之前。

    与此相关的一些链接(最后一个是正确格式的html/css示例):

    【讨论】:

      猜你喜欢
      • 2014-04-04
      • 2014-01-03
      • 2012-01-05
      • 1970-01-01
      • 2019-09-25
      • 2018-10-03
      • 1970-01-01
      • 2013-07-30
      相关资源
      最近更新 更多