UPD:新增5月5日
我已经完成了我的工作,这是从一些其他的答案编制下一解决:
- Print page numbers
- Relative position into the parent element
现在,我可以看到每个页面上的数字。
重要
此解决方案不显示总页数。
在本帖末尾查看如何显示页面总数。
我改变树枝模板
{% for Person in AllPersons %}
{% set pageNum = 1 %}
<div class="page">
<div class="content">
<!-- there is some the content of the first page //-->
</div>
<div class="break">{{pageNum}}</div>
</div>
{% set pageNum = pageNum + 1 %}
<div class="page">
<div class="content">
<!-- there is some the content of the second page //-->
</div>
<div class="break">{{pageNum}}</div>
</div>
<!-- other pages generated the same way //-->
{% endfor %}
和CSS
.page {
background: white;
margin: 0 auto;
margin-bottom: 0.5cm;
box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);
width: 21cm;
height: 29.7cm;
position: relative;
}
.content {
padding: 0.5cm 1cm 0.5cm 2cm;
}
.break{
page-break-after: always;
position: absolute;
bottom: 5mm;
right: 5mm;
}
.break:before{
white-space: nowrap;
-moz-border-radius: 5px;
-moz-box-shadow: 0px 0px 4px #222;
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
}
UPD:四小时
之后添加到显示的页面的总数,我用了下一个脚本
$(document).ready(function() {
$(".person").each(function(){
var totalNumber = $(this).children(".page").length;
$(this).children(".page").each(function (index){
$(this).children(".break").append("page "+(index+1)+" of "+ totalNumber);
})
})
});
一点点,我改变了嫩枝模板
{% for Person in AllPersons %}
{% set pageNum = 1 %}
<div class="person"> <!-- This tag was addaed //-->
<div class="page">
您还可以通过在CSS '。第插入后续行使用表格布局{display:block;'and'.break { \t display:table-footer-group;' – Konstantin