jsreport中的页码 [英] Page number in jsreport

查看:102
本文介绍了jsreport中的页码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 jsreport 中显示页码? 我在工具的首页或通过谷歌搜索都找不到它.

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

非常感谢!

推荐答案

我假设您要在由phantom-pdf配方创建的pdf报告中要求页码...

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

您可以在template.phantom.header中使用特殊标签{#pageNum}{#numPages}:

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

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

请注意,您还可以在页眉/页脚中使用javascript来自定义页码的可见性或值.

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>

此处的文档

这篇关于jsreport中的页码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆