Specifies action items for a PDF or FlashPaper document created by the cfdocument tag. Action items include the following:

  • header
  • footer
  • pagebreak


Data output tags


<cfdocument ...> 
type = "pagebreak|header|footer" 
evalAtPrint = "true" 
header/footer text </cfdocumentitem> 

See also



ColdFusion 9: Added the evalAtPrint attribute.

ColdFusion 8: Added support for cfdocument.currentpagenumber, cfdocument.totalpagecount cfdocument.totalsectionpagecount, and cfdocument.currentsectionpagenumber scopevariables.

ColdFusion MX 7.01: Added the src, srcfile, and mimetype attributes.ColdFusion MX 7: Added this tag.









Specifies the action:

  • pagebreak: starts a new page at the location of the tag.
  • header: uses the text between the <cfdocumentitem> and </cfdocumentitem> tags as the running header.
  • footer: uses the text between the <cfdocumentitem> and </cfdocumentitem> tags as the running footer.




A Boolean value that determines if the contents of the cfdocumentitem tag body has to be evaluated at the time of printing the document.

  • true: evaluates the contents of the cfdocumentitem tag body only at the time of printing the document.
  • false: evaluates the contents of the cfdocumentitem tag body immediately.


Use the evalAtPrint tag to evaluate the contents of the document before printing and to also accept additional attributes. Use the cfdocumentitem tag to control the formatting of a PDF or FlashPaper report. This tag must be wrapped inside a <cfdocument> </cfdocument> pair.
Write code for one cfdocumentitem tag for each page break, running header, or running footer. ColdFusion has added support for cfdocument scope variables within the cfdocumentitem tag. You can use the cfdocument scope variable, cfdocument.currentpagenumber, to display the current page number in a header or footer. You can also use {{cfdocument.totalpagecoun}}t to display the total number of pages, for example:

<cfdocumentitem type= "footer>
#cfdocument.currentpagenumber# of #cfdocument.totalpagecount#

For an example that uses the cfdocument.totalsectionpagecount and cfdocument.currentsectionpagenumber scope variables, see cfdocument.
You can use cfdocumentitem tags with or without the cfdocumentsection tag, as follows:

  • Without cfdocumentsection The cfdocumentitemattribute applies to the entire document, as follows:
    • If the tag is at the top of the document, it applies to the entire document.
    • If the tag is in the middle of the document, it applies to the rest of the document.
    • If the tag is at the end of the document, it has no affect.
  • With cfdocumentsection tags The cfdocumentitem attribute applies only to the section and overrides previously specified header and footer specifications.


<cfquery datasource="cfdocexamples" name="parksQuery"> 
SELECT parkname, suptmgr from parks 

<cfdocument format="PDF"> 
<cfdocumentitem type="header">National Parks Report</cfdocumentitem> 
<!--- Use a footer with current page of totalpages format. ---> 
<cfdocumentitem type="footer"> 
<cfoutput>Page #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#</cfoutput> 

<h1>Park list</h1> 
<table width="95%" border="2" cellspacing="2" cellpadding="2" > 
<cfoutput query="parksQuery"> 
<td><font size="-1">#parkname#</font></td> 
<td><font size="-1">#suptmgr#</font></td> 
Adobe logo

Sign in to your account