开发者

Pisa and lastPage

开发者 https://www.devze.com 2023-02-09 09:44 出处:网络
Greetings, 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 offic

Greetings,

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>

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

Can you help me?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号