【问题标题】:Pisa and lastPage比萨和最后一页
【发布时间】:2011-02-08 10:46:24
【问题描述】:

您好,

我正在使用 PISA 为我的网页生成一些不错的 pdf。无论如何,我需要在 pdf 文档的最后一页中放置一个页脚 div -only-。我在官方文档中找到了标签“@page lastPage”,但我无法让它工作。我给你看我的一些代码:

<style type="text/css">
    @page {
        size: {{ pagesize }};
        margin: 1cm;
        margin-bottom: 5.6cm;
        margin-top: 7cm;

        @frame header { 
            -pdf-frame-content: headerContent; 
            top:1cm; 
            margin-left: 1cm; 
            margin-right: 1cm; 
            height:6.5cm;
            } 

        @frame middle{
            -pdf-frame-content: middleContent; 
            top:6.5cm;
            margin-left: 1cm; 
            margin-right: 1cm;
            height:14cm;    
        }

    }

    @page lastPage{
        size: {{ pagesize }};
        margin: 1cm;
        margin-bottom: 5.6cm;
        margin-top: 7cm;

        @frame header { 
            -pdf-frame-content: headerContent; 
            top:1cm; 
            margin-left: 1cm; 
            margin-right: 1cm; 
            height:6.5cm;
            } 

        @frame middle{
            -pdf-frame-content: middleContent; 
            top:6.5cm;
            margin-left: 1cm; 
            margin-right: 1cm;
            height:11cm;    
        }

        @frame footer {
            -pdf-frame-content: footerContent;
            bottom: 0cm;
            margin-left: 1cm;
            margin-right: 1cm;
            height:5.5cm;
            text-align:left;
        }
    } 
</style>

和html:

...
<div id="headerContent">my header</div>
<div id="middleContent">my content</div>
<div id="footerContent">I want this foot in the last page only</div>
...

你能帮帮我吗?

【问题讨论】:

  • 这个问题有什么问题吗? :(

标签: django footer pisa


【解决方案1】:

您现在可能已经找到了解决方法,但我在 the pisa mailing list 上偶然发现了这个:

<pdf:nextpage template='lastPage' /> 

从文档中并不清楚,但我认为为了使用不同的页面布局,您需要手动指定中断。

【讨论】:

  • 当我知道我要写最后一页时,我认为这很有效。但是,如果我无法预测,我该怎么办? (例如,对于跨越多个页面的表格)。谢谢
  • 是的,我不确定这是否有效。至少我想不通。 XHTML2PDF 有点乱。
  • 这个aswer没有正确的标签,不存在标签来检测最后一页。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-22
  • 2012-08-24
  • 1970-01-01
  • 1970-01-01
  • 2010-11-27
  • 2014-02-18
相关资源
最近更新 更多