CFDOCUMENT is not putting page number on first page

135 Views Asked by At

I have a page that is pulling data from a table, looping through it, and creating PDF pages with the content. I've declared a footer for displaying the page number, which works on every page but the very first. Any ideas what could be going on? I'm on CF2018, version: 2018,0,10,320417

In the code below, "plusVal" is either 0 or 1 depending on whether the generated report will have a cover page I create later and merge with the PDF.

<cfdocument format="pdf" filename="#tempFilepath#\#fileName#_temp.pdf" overwrite="true" bookmark="true" localurl="false"><?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Report</title>
    </head>
    <body>  
    <cfoutput query="data"> 
        <cfif len(template.header_logo) AND fileExists("#application.linkMediaRoot#\reports\logo\#template.header_logo#")>
            <cfdocumentitem type="header"><img src="#application.mediaLink#/reports/logo/#template.header_logo#" /></cfdocumentitem>
        </cfif>
        <cfdocumentsection name="#data.page_title#">
            <br><br>
            <div style="font-family: Arial, Helvetica, sans-serif; !important;">
                <h1 style="font-size:16pt;">#data.page_title#</h1>
                <p>#page_content#</p>
                <cfif len(data.additional_content)>
                    <p>#data.additional_content#</p>
                </cfif>
            </div>
        </cfdocumentsection>
        <cfdocumentitem type="footer" evalAtPrint="true">
            <span style="font-family: Arial, Helvetica, sans-serif; font-size:10pt; !important">Page #cfdocument.currentpagenumber+plusVal# of #cfdocument.totalpagecount+plusVal#</span>
        </cfdocumentitem>
    </cfoutput>
    </body>
    </html>
</cfdocument>
0

There are 0 best solutions below