Pisa and lastPage
Asked Answered
M

1

1

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?

Midship answered 8/2, 2011 at 10:46 Comment(1)
anything wrong with the question? :(Midship
V
1

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.

Voltcoulomb answered 10/6, 2011 at 15:31 Comment(3)
I think this works when I know that I'm going to write the last page. But how can I do if I can't predict it? (e.g. for tables that span multiple pages). ThanksRixdollar
Yeah, I'm not sure that works at all. At least I couldn't figure it out. XHTML2PDF is a bit of a mess.Voltcoulomb
This aswer dont have correct tag, dont exist tag to detect lastpage.Modestomodesty

© 2022 - 2024 — McMap. All rights reserved.