【发布时间】:2014-04-04 13:39:39
【问题描述】:
我正在使用飞碟 java 库。
我正在尝试为生成的 pdf 添加页脚。
目标是每个页面的页脚相同,最后一页的内容不同。
html>
<head>
<style type="text/css">
@page {
size: 8.5in 11in;
margin-bottom: 1in;
@bottom-left {
content: element(footer_one);
}
@bottom-right{
content: element(footer_two);
}
@bottom-center{
content: element(footer_rights);
}
}
#footer_two {position: running(footer_two); }
#footer_one {position: running(footer_one); }
#footer_three {position: running(footer_three);}
#footer_two, #footer_one, #footer_three { margin: 0 padding:0;}
#footer_three { border-top: 2px solid #3390FF;}
</style>
</head>
<body>
<div id="footer_one">
some text short text about three words, on each page
</div>
<div id="footer_two">
some text short text, like page numbers etc, on each page
</div>
<div>
Whole body content
</div>
<div id="footer_three">
some text looooooooonnnnnnnnnggggggggg text, some about ten rows. Only on last page
</div>
</body>
这几天我一直在苦苦挣扎,在网上找到的任何建议都不够好。
我正在尝试
@page:last {}
或与:
@bottom-left {
content: element(footer_one, last-except);
}
@bottom-right{
content: element(footer_two, last-except);
}
但似乎 :last 伪选择器不起作用。
最好的方法是在最后一页使用完全不同的一个页脚,其中包括这三个页脚的内容。 我只能在最后一页添加页脚,但我不能禁用那些简单的页脚形成前一页。
也许还有其他方法? 我将不胜感激。
【问题讨论】:
标签: html css pdf-generation flying-saucer