Creates PDF or FlashPaper output from a text block containing CFML and HTML.
<cfdocument
format = "PDF" or "FlashPaper"
filename = "filename"
overwrite = "yes" or "no"
name = "output variable name"
pagetype = "page type"
pageheight = "page height in inches"
pagewidth = "page width in inches"
orientation = "portrait/landscape"
margintop = "number"
marginbottom = "number"
marginleft = "number"
marginright = "number"
unit = "in" or "cm"
encryption = "128-bit" or "40-bit" or "none"
ownerpassword = "password"
userpassword = "password"
permissions = "permission list"
fontembed = "yes" or "no"
backgroundvisible = "yes" or "no"
scale = "percentage less than 100">HTML and CFML code
</cfdocument>
cfreport
,
cfdocumentitem, cfdocumentsection
ColdFusion MX 7: Added this tag.
Attribute | Req/Opt | Default | Description |
---|---|---|---|
format |
Required |
|
Specifies the report format:
|
filename |
Optional |
|
Specifies the name of a file to contain the PDF or FlashPaper output. If you omit the |
overwrite |
Optional |
no |
Specifies whether ColdFusion MX overwrites an existing file. Used in conjunction with the |
name |
Optional |
|
Specifies the name of an existing variable into which the tag stores the PDF or FlashPaper output. |
pagetype |
Optional |
A4 |
Specifies the page size into which ColdFusion generates the report:
|
pageheight |
Optional |
|
Specifies the page height in inches (default) or centimeters. This attribute is only valid if |
pagewidth |
Optional |
|
Specifies the page width in inches (default) or centimeters. This attribute is only valid if |
orientation |
Optional |
portrait |
Specifies the page orientation:
|
margintop |
Optional |
|
Specifies the top margin in inches (default) or centimeters. To specify the top margin in centimeters, include the |
marginbottom |
Optional |
|
Specifies the bottom margin in inches (default) or centimeters. To specify the bottom margin in centimeters, include the |
marginleft |
Optional |
|
Specifies the left margin in inches (default) or centimeters. To specify the left margin in centimeters, include the |
marginright |
Optional |
|
Specifies the right margin in inches (default) or centimeters. To specify the right margin in centimeters, include the |
unit |
Optional |
in |
Specifies the default unit for the
|
encryption |
Optional |
None |
(
|
ownerpassword |
Optional |
|
( |
userpassword |
Optional |
|
( |
permissions |
Optional |
|
(
Separate multiple permissions with a comma. |
fontembed |
Optional |
yes |
Specifies whether ColdFusion embeds fonts in the output:
Selective: embed all fonts except Java fonts and core fonts. For more information, see Usage. |
backgroundvisible |
Optional |
no |
Specifies whether the background prints when the user prints the document:
|
scale |
Optional |
Calculated by ColdFusion |
Specifies a scale factor as a percentage. Use this option to reduce the size of the HTML output so that it fits on that paper. Specify a number less than 100. |
Use the cfdocument
tag to render HTML and CFML output into PDF or FlashPaper format. ColdFusion MX does not return HTML and CFML outside of the <cfdocument>
</cfdocument>
pair.
The cfdocument
tag can render HTML that supports the following standards:
The cfdocument
tag does not support the Internet Explorer-specific HTML generated by Microsoft Word.
The PDF or FlashPaper document returned by the cfdocument
tag overwrites any previous HTML in the input stream and ignores any HTML after the </cfdocument>
tag.
You cannot embed a cfreport
tag in a cfdocument
tag.
When you use the cfdocument
tag, ColdFusion MX creates a new scope named cfdocument. This scope contains the following variables:
Note: The cfdocument scope variables are reserved for page number rendering. Do not use them in ColdFusion expressions. For example, the following code does not work:
<cfif cfdocument.currentpagenumber gt 1> <cfoutput>#cfdocument.currentpagenumber-1#</cfoutput> </cfif>
<cfdocument format="flashpaper"> <p>This is a document rendered by the cfdocument tag.</p> <table width="50%" border="2" cellspacing="2" cellpadding="2"> <tr> <td><strong>Name</strong></td> <td><strong>Role</strong></td> </tr> <tr> <td>Bill</td> <td>Lead</td> </tr> <tr> <td>Susan</td> <td>Principal Writer</td> </tr> <tr> <td>Adelaide</td> <td>Part Time Senior Writer</td> </tr> <tr> <td>Thomas</td> <td>Full Time for 6 months</td> </tr> <tr> <td>Michael</td> <td>Full Time for 4 months</td> </tr> </table> </cfdocument>