Code Examples for the cfdocument Tag

June 28th, 2006 by Posted in Macromedia FlashPaper, Macromedia Products

   

Code Examples for the cfdocument Tag

There are a few additional supporting subset tags for the cfdocument tag: cfdocumentitem and cfdocumentsection. These two tags provide additional format control.

The cfdocumentitem tag has three different attributes: header, footer, and pagebreak. Their attribute names indicate their functionality. The header and footer attribute values support document headers and footers, while the pagebreak attribute value specifies an inserted page break in the document (see Code Example 1).

Code Example 1: Using the cfdocument tag with the supporting cfdocumentitem tag

<cfdocument format="pdf">
Hello World!!!
<cfdocumentitem type="pagebreak"/>
<cfdocumentitem type="header">
Company Name
</cfdocumentitem >
<cfdocumentitem type="footer">
<div align="center">
<font color="navy" size="1" face="Tahoma">
page
<cfoutput>
#cfdocument.currentpagenumber#
</cfoutput>/
<cfoutput>
#cfdocument.totalpagecount#
</cfoutput>
</font>
</div>
</ cfdocumentitem >
<!-- insert your other HTML text here-->
</cfdocument>

You use the cfdocumentsection tag to break HTML into different segments. You can specify unique headers, footers, and other HTML style for each section without affecting other parts of the document (see Code Example 2).

Code Example 2: Using the cfdocument tag with the cfdocumentsection tag

<cfdocument format="flashpaper/pdf">
<cfdocumentsection margintop="1">
<cfdocumentitem type="header">
Company Name
</cfdocumentitem >
<cfdocumentitem type="footer">
<div align="center">
<font color="navy" size="1" face="Tahoma">
page
<cfoutput>
#cfdocument.currentpagenumber#
</cfoutput>/
<cfoutput>
#cfdocument.totalpagecount#
</cfoutput>
</font>
</div>
</ cfdocumentitem >

<body style="background-color: #dddddd">
Hello World!!!
</body>
</cfdocumentsection>

<cfdocumentsection margintop="2">
<cfdocumentitem type="header">
Different Header
</cfdocumentitem >
<cfdocumentitem type="footer">
different footer
</ cfdocumentitem >

<body style="background-color: #eeeeee">
Another Section
</body>
</cfdocumentsection>
</cfdocument>

The user-requirements criteria—ease of use and standards support—were key factors in creating the cfdocument printing functionality. The cfdocument tag gives you a tool that you can use immediately.

We’ll continue to refine this important feature in the future, and we welcome your feedback. We hope you are able to make use of this great new functionality wherever you need to print web content.

  •  

  •    
  •