<cfdocument>
Creates a PDF document from a text block containing CFML and HTML.
Note that Word and Excel conversion is not available.
This tag may have a body.
This tag is also supported within <cfscript>
Requires Extension: PDF Extension for Jakarta EE (Lucee 7+)
<cfdocument
backgroundvisible=boolean
encryption=String
filename=String
fontembed=string
fontdirectory=string
format=string
page=any
margin=any
marginbottom=number
marginleft=number
marginright=number
margintop=number
mimetype=string
name=string
orientation=string
overwrite=boolean
ownerpassword=string
pageheight=number
pagewidth=number
pagetype=string
permissions=string
scale=number
src=string
srcfile=string
type=string
unit=string
userpassword=string
proxyHost=string
proxyPort=number
proxyUser=string
proxyPassword=string
bookmark=boolean
htmlbookmark=boolean
localUrl=boolean
authUser=string
authPassword=string
userAgent=string
saveAsName=string
><!--- body --->[</cfdocument>]
| Attribute | Description |
|---|---|
encryption
String, optional
|
edit
define if the output should be encrypted and how deep |
filename
String, optional
|
edit
name for output file, if not defined output will be written to response stream |
fontembed
string, optional
|
edit
define if fonts will embedded with the file |
fontdirectory
string, optional
|
edit
directory that contains additional font files (.ttf) and a pd4fonts.properties to describe them. Note: Classic engine works using the font-family-name from pd4fonts.properties file. Modern (Flying saucer) engine works using the font-family-name from the .ttf file with the same case. |
format
string, optional
|
edit
format of the created file |
page
any, optional
|
edit
Specifies the page info in a struct like this {width:10, height:5, type:A4} |
margin
any, optional
|
edit
Specifies the margin in inches (default), centimeters or points. The attribute unit controls the type. possible values is a number, so margin is the same all around, or a struct like this {top:1,bottom:1,left:2,right:2} |
marginbottom
number, optional
|
edit
Specifies the bottom margin in inches (default) or centimeters. To specify bottom margin in centimeters, include the unit=cm attribute. |
marginleft
number, optional
|
edit
Specifies the left margin in inches (default) or centimeters. To specify left margin in centimeters, include the unit=cm attribute. |
marginright
number, optional
|
edit
Specifies the right margin in inches (default) or centimeters. To specify right margin in centimeters, include the unit=cm attribute. |
margintop
number, optional
|
edit
Specifies the top margin in inches (default) or centimeters. To specify top margin in centimeters, include the unit=cm attribute. |
mimetype
string, optional
|
edit
mimetype of the source (when attribute src or srcfile are defined) |
name
string, optional
|
edit
name of a variable to store the output in it Alias: variable |
orientation
string, optional
|
edit
Page orientation. Can be "landscape" or "portrait". Defaults to "portrait". |
overwrite
boolean, optional
|
edit
define if an existing file will be overwritten or not |
ownerpassword
string, optional
|
edit
Specifies an owner password (format="PDF" only). |
pageheight
number, optional
|
edit
used when pagetype is custom |
pagewidth
number, optional
|
edit
used when pagetype is custom |
pagetype
string, optional
|
edit
defined the used format for the page (,legal,letter,A4,A5,B4,B5,B4-JIS,B5-JIS and custom) |
permissions
string, optional
|
edit
Sets the permissions for the document
|
src
string, optional
|
edit
define a url or a relative path on the local system to a file that should be transferred to a pdf |
srcfile
string, optional
|
edit
define an absolute path to a file that should be transferred to a pdf |
type
string, optional
|
edit
Specifies which engine should be used to render the document. Options are:
Defaults to the Application's |
unit
string, optional
|
edit
set the unit for pageheight, pagewidth, and margin... |
userpassword
string, optional
|
edit
Specifies a user password (format="PDF" only). Defaults to "empty" if is not set, and encryption is set to 40 bit or 128 bit. |
proxyHost
string, optional
|
edit
alias for proxyHost Alias: proxyserver |
proxyPort
number, optional
|
edit
The port number on the proxy server from which the object is requested. Default is 80. When used with resolveURL, the URLs of retrieved documents that specify a port number are automatically resolved to preserve links in the retrieved document. |
proxyUser
string, optional
|
edit
When required by a proxy server, a valid username. |
proxyPassword
string, optional
|
edit
When required by a proxy server, a valid password. |
bookmark
boolean, optional
|
edit
Specifies whether bookmarks are created in the document |
htmlbookmark
boolean, optional
|
edit
If true, it is possible to convert outlines to a list of named anchors ( |
localUrl
boolean, optional
|
edit
Specifies whether to retrieve image files directly from the local drive |
authUser
string, optional
|
edit
User name sent to the target URL for Basic Authentication. Combined with password to form a base64 encoded string that is passed in the Authenticate header. Does not provide support for Integrated Windows, NTLM, or Kerberos authentication. |
authPassword
string, optional
|
edit
Password sent to the target URL for Basic Authentication. Combined with username to form a base64 encoded string that is passed in the Authenticate header. Does not provide support for Integrated Windows, NTLM, or Kerberos authentication. |
userAgent
string, optional
|
edit
Text to put in the HTTP User-Agent request header field. Used to identify the request client software. |
saveAsName
string, optional
|
edit
(format="PDF" only) The filename that appears in the SaveAs dialog when a user saves a PDF file written to the browser. |
Unimplemented Attribute(s)
| Attribute | Description |
|---|---|
backgroundvisible
boolean,
optional
|
edit
Specifies whether the background prints when the user prints the document * unimplemented * |
scale
number,
optional
|
edit
Define a scale factor as a percentage. This option is used to reduce the size of the HTML output so that it fits on that paper. Define a number less than 100. * unimplemented * |
Examples
editSimple example for cfdocument
<cfdocument format="pdf">
<h1>Welcome to Lucee</h1>
<h5>Example Page</h5>
<p>Example for <b>Cfdocument</b></p>
</cfdocument>
See also
- PDFs
- PDF Engine - CFDOCUMENT using Flying Saucer
- <cfdocumentitem>
- <cfdocumentsection>
- <cfpdf>
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)