Page number in jsreport

扶醉桌前 提交于 2019-12-11 03:23:34

问题


Is it possible to display page number in jsreport? I couldn't find this either on the homepage of the tool nor by googling.

Many thanks in advance!


回答1:


I assume you ask for page numbers in a pdf report created by phantom-pdf recipe...

You can use special tags {#pageNum} and {#numPages} in template.phantom.header for this:

<div style='text-align:center'>{#pageNum}/{#numPages}</div>

Note you can use also javascript in header/footer to customize visibility or value of the page numbers.

<span id='pageNumber'>{#pageNum}</span>
<script>
    var elem = document.getElementById('pageNumber');
    if (parseInt(elem.innerHTML) <= 3) {
        //hide page numbers for first 3 pages
        elem.style.display = 'none';
    }
</script>

Documentation here



来源:https://stackoverflow.com/questions/31326567/page-number-in-jsreport

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!