Skip to main content
scott.davey
Participant
June 11, 2024
Answered

cfhtmltopdfitem _LASTPAGENUMBER Not Working

  • June 11, 2024
  • 1 reply
  • 165 views

Hey all. I have a footer in my PDF document and I'm trying to show "Page 1 of 2", for example.

 

 

<cfhtmltopdfitem type="footer" align="left">
        <cfoutput>
            <body style="padding: 0px; margin: 0px; width: 100%; border-top: 1px solid ##000000;">
                <p style="padding: 0px; margin: 5px 0px 0px 0px; width: 50%; float: left;">As of #dateFormat(now(), "mmm dd, yyyy")#</p>
                <p style="padding: 0px; margin: 5px 0px 0px 0px; width: 50%; float: left; text-align: right;">Page _PAGENUMBER of _LASTPAGENUMBER</p>
            </body>
        </cfoutput>
    </cfhtmltopdfitem>

 

When I render the PDF, it shows "Page 1 of _LASTPAGENUMBER", so it looks like it's not getting a proper value for _LASTPAGENUMBER.
 
I have also tried using:

 

Page #cfhtmltopdf.currentPage# of #cfhtmltopdf.totalPageCount#

 

But it outputs the same thing as above.

    This topic has been closed for replies.
    Correct answer scott.davey

    I may have figured out how to get it to work..

     

    I had to add a pace between _LASTPAGENUMBER and my closing </p> tag. This still feels like an issue but at least I can finish my task.

    1 reply

    scott.davey
    scott.daveyAuthorCorrect answer
    Participant
    June 11, 2024

    I may have figured out how to get it to work..

     

    I had to add a pace between _LASTPAGENUMBER and my closing </p> tag. This still feels like an issue but at least I can finish my task.