问题
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?
回答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.
来源:https://stackoverflow.com/questions/4932073/pisa-and-lastpage