Creates PDF or FlashPaper output from a text block containing CFML and HTML.
<cfdocument
backgroundvisible = "yes" or "no"
encryption = "128-bit" or "40-bit" or "none"
format = "PDF" or "FlashPaper"
filename = "filename"
fontembed = "yes" or "no"
marginbottom = "number"
marginleft = "number"
marginright = "number"
margintop = "number"
mimetype = "text/plain" or "text/xml" or "image/jpeg" or "image/png" or "image/gif"
name = "output variable name"
orientation = "portrait" or "landscape"
overwrite = "yes" or "no"
ownerpassword = "password"
pageheight = "page height in inches"
pagetype = "page type"
pagewidth = "page width in inches"
permissions = "permission list"
scale = "percentage less than 100">
src = "url or path relative to web root"
srcfile = "absolute path of file"
unit = "in" or "cm"
userpassword = "password"
HTML and CFML code</cfdocument>
cfreport, cfdocumentitem, cfdocumentsection
ColdFusion MX 7 Updater: Added the src, srcfile, and mimetype attributes.
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 |
letter |
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. |
|
src |
Optional |
|
Specifies the URL or the relative path to the web root. You cannot specify both the |
|
srcfile |
Optional |
|
Specifies the absolute path of a file that is on the server. You cannot specify both the |
|
mimetype |
Optional |
text/html |
Specifies the MIME type of the source document. Commom MIME types include:
|
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.
You can use the src, srcfile, and mimetype attributes to create PDF or FlashPaper output from a secified file or URL. You use the src and srcfile attributes instead of using the cfhttp tag to display the result in the cfdocument tag. Do not use the src or srcfile attributes with any other content inside the cfdocument tag, because ColdFusion ignores any body content you specify in the cfdocument tag when you use the src or srcfile attribute.
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>
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting
Version 7
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00000236.htm
Comments
No screen name said on Feb 15, 2005 at 11:23 AM :