First, some details on my setup:
Virtual server with Windows Server 2016
Lucee 6.0.2.8-SNAPSHOT
Apache Tomcat 9.0.89
Java 11.0.22 (Eclipse Adoptium) 64bit
I am working with the <cfdocument>
family of tags. I have found myself copying and pasting example code from others and having the code work. Meanwhile, I try to write what is seemingly the same code structure, and nothing is displayed - just a blank, full-page PDF. Specifically, I am having what seems like the most problem with the <cfdocumentitem>
tags for the headers and footers.
Example of working code I found online:
<cfdocument format="PDF">
<cfoutput>
<!--- Section 1 --->
<cfdocumentsection name="bookmark1">
<cfdocumentitem type="header">
<h1 style="text-align:center;">BIG FANCY HEADER</h1>
</cfdocumentitem>
Bacon ipsum dolor sit amet sirloin fatback #dateformat(now(), "short")#
<cfdocumentitem type="footer">
<h1 style="text-align:center;">Page #cfdocument.currentPageNumber# of #cfdocument.totalPageCount#</h1>
</cfdocumentitem>
</cfdocumentsection>
<!--- Section 2 --->
<cfdocumentsection name="bookmark2">
<cfdocumentitem type="header">
<h1 style="text-align:center;">2nd page header</h1>
</cfdocumentitem>
Bacon ipsum dolor sit amet sirloin fatback #dateformat(now(), "short")#
<cfdocumentitem type="footer">
<h1 style="text-align:center;">Page #cfdocument.currentPageNumber# of #cfdocument.totalPageCount#</h1>
</cfdocumentitem>
</cfdocumentsection>
</cfoutput>
</cfdocument>
Example of my own code that generates a blank page:
<cfdocument format="pdf">
<cfoutput>
<cfdocumentsection name="test">
<cfdocumentitem type="header">
<h1>Hello</h1>
</cfdocumentitem>
<cfdocumentitem type="footer">
<h1>Goodbye</h1>
</cfdocumentitem>
</cfdocumentsection>
</cfoutput>
</cfdocument>
Asside from my example only having one , I cannot seem to find what the difference is between the two code blocks or why one displays output and the other does not. Can anyone spot what’s going on here?