1

使用 Lucee,如何使用 cfdocument 范围变量将动态页码添加到 pdf 文件中?

  • cfdocument.totalsectionpagecount
  • cfdocument.currentsectionpagenumber
  • cfdocument.currentpagenumber
  • cfdocument.totalpagecount

我尝试了下面的代码。它生成pdf,但页眉和页脚是空的,而不是显示页码,即。“Y中的X”。

<cfdocument format="pdf">
    <cfdocumentitem type="header" evalatprint="true">
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <strong><tr><td align="right"><cfoutput>#cfdocument.currentsectionpagenumber# of</strong>
                <strong>#cfdocument.totalsectionpagecount#</cfoutput></td></tr></strong>
        </table>
    </cfdocumentitem>
    <cfdocumentitem type="footer" evalatprint="true">
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <strong><tr><td align="center"><cfoutput>#cfdocument.currentpagenumber# of</strong>
                <strong>#cfdocument.totalpagecount#</cfoutput></td></tr></strong>
        </table>
    </cfdocumentitem>
    <cfdocumentsection>
        <h1>Section 1</h1>
        <cfloop from=1 to=50 index="i">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna     aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis     aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint     occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<p>
        </cfloop>
    </cfdocumentsection>
</cfdocument>
4

0 回答 0