ColdFusion 9.0 Resources |
cfdocumentitemDescriptionSpecifies action items for a PDF or FlashPaper document created by the cfdocument tag. Action items include the following:
Syntax<cfdocument ...> <cfdocumentitem type = "pagebreak|header|footer" evalAtPrint = "true" header/footer text </cfdocumentitem> </cfdocument> Note: You can specify
this tag’s attributes in an attributeCollection attribute
whose value is a structure. Specify the structure name in the attributeCollection attribute
and use the tag’s attribute names as structure keys.
HistoryColdFusion 8: Added support for cfdocument.currentpagenumber, cfdocument.totalpagecount cfdocument.totalsectionpagecount, and cfdocument.currentsectionpagenumber scopevariables. Added the evalAtPrint attribute. ColdFusion MX 7.01: Added the src, srcfile, and mimetype attributes. ColdFusion MX 7: Added this tag. Attributes
UsageUse 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.totalpagecount to display the total number of pages, for example: ... <cfdocumentitem type= "footer> #cfdocument.currentpagenumber# of #cfdocument.totalpagecount# </cfdocumentitem> 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:
Example<cfquery datasource="cfdocexamples" name="parksQuery"> SELECT parkname, suptmgr from parks </cfquery> <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> </cfdocumentitem> <h1>Park list</h1> <table width="95%" border="2" cellspacing="2" cellpadding="2" > <tr> <th>Park</th> <th>Manager</th> </tr> <cfoutput query="parksQuery"> <tr> <td><font size="-1">#parkname#</font></td> <td><font size="-1">#suptmgr#</font></td> </tr> </cfoutput> </table> </cfdocument> |