Cfdocument error on total page count

h/t Giampiero Vaccari https://groups.google.com/forum/#!topic/lucee/xTRAEb1NCb8

I’m porting some code from ACF 9 to Lucee 4.5.
I’ve found an issue in the output produced by cfdocument.
The cfdocument.totalpagecount is wrong as it is always equal to cfdocument.totalsectionpagecount.
Try to run the following test snippets in ACF9 and Lucee 4.5 and see the different results.
Any idea?
Thanks

<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> 
  
<cfdocumentsection>
    <h1>Section 2</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> 
  
<cfdocumentsection>
<h1>Section 3</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>

If you are migrating now, I would suggest you migrate to the latest release of Lucee 5, as 4.5 is only receiving security fixes as such now, see Lucee v4 unsupported for bugs. So if there is a bug, it is only likely to be fixed in Lucee 5 anyway. Also, you might find it has already been fixed (but I really have no idea on that front).

There is already a ticket related to this issue LDEV-1004.
I’ve added test files in that. Please follow this.

I’m not sure LDEV-1004 is the correct ticket for this. That ticket is really just about CSS styles not working. This post is about the page number variables no having the correct values in them. This probably deserves its own ticket.

https://luceeserver.atlassian.net/browse/LDEV-2404

This is confirmed to still be an issue on the latest Lucee snapshot using Flying Saucer.

1 Like