比萨和最后页 [英] Pisa and lastPage

查看:195
本文介绍了比萨和最后页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我正在使用PISA生成一些漂亮的我的网页的pdf。无论如何,我需要在PDF文档的最后一页放一个页脚。我在官方文档中找到了@page lastPage标签,但我无法使其正常工作。我向你介绍一下我的代码:

I'm using PISA to generate some nice pdf of my web pages. Anyway I'd need to put a footer div -only- in the last page of the pdf document. I found the tag "@page lastPage" in the official documentation but I can't make it work. I show you some of my code:

<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>
...

你能帮我吗?

推荐答案

你现在可能已经找到了一个解决方法,但是我在比萨邮件列表

You've probably found a workaround by now, but I stumbled across this on the pisa mailing list:

<pdf:nextpage template='lastPage' /> 

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

It's not clear from the documentation, but I think in order to use a different page layout, you need to specify the break manually.

这篇关于比萨和最后页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆