Manipulates existing PDF documents. The following list describes some of the tasks you can perform with the cfpdf tag: Merge several PDF documents into one PDF document. Extract pages from multiple PDF documents and generate a new PDF document. Linearize multipage PDF documents for faster display. Encrypt or decrypt PDF files for security.
Order in which the PDF files are sorted: yes: files are sorted in ascending order no: files are sorted in descending order
Values:
true
false
copyfrom
string
The filename of the PDF document from which to copy the watermark
destination
string
The pathname of the modified PDF document. If the destination file exists, you must set the overwrite attribute to yes. If the destination file does not exist, ColdFusion creates it as long as the parent directory exists. (optional)
directory
string
Specify the directory of the PDF documents to merge. You must specify either the directory or the source. If you specify the directory, you must also specify the order.
encrypt
string
Specify the type of encryption used on the source PDF document
CF 2016+ Added the AES_256R5 and AES_256R6 algorithms. On older JREs these need the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.
Values:
RC4_40
RC4_128
RC4_128M
AES_128
AES_256R5
AES_256R6
none
flatten
boolean
Default:no
Specify whether the output file is flattened: yes: the formatting is removed and the file is flattened no: the format of the source PDF is maintained in the output file.
Values:
true
false
foreground
boolean
Default:no
Specify whether the watermark is placed in the foreground of the PDF document: yes: the watermark appears in the foreground no: the watermark appears in the background
Values:
true
false
image
string
Specify the image used as a watermark. You can specify a filename or a ColdFusion image variable.
info
string
Required
Specify the structure variable for relevant information, for example, #infoStruct#. ColdFusion ignores read only information, such as the creation date, application used to create the PDF document, and encryption parameters.
isBase64
boolean
Default:no
Specify whether the image used a watermark is in Base64 format: yes: the image is in Base64 format no: the image is not in Base64 format
Values:
true
false
keepbookmark
boolean
Default:false
Specify whether bookmarks from the source PDF documents are retained in the merged document: yes: the bookmarks are retained no: the bookmarks are removed
Values:
true
false
name
string
Specify the PDF document variable name, for example, myPDFdoc. If the source is a PDF document variable, you cannot specify the name attribute again; you can write the modified PDF document to the destination.
newOwnerPassword
string
Specify the password for the owner of the PDF document.
newUserPassword
string
Specify the password for the user of the PDF document.
opacity
string
Default:3
Specify the opacity of the watermark. Valid values are integers in the range 0 (transparent) through 10 (opaque).
order
string
Required
Specify the order in which the PDF documents in the directory are merged: name: orders the documents alphabetically time: orders the documents by timestamp
Values:
name
time
overwrite
string
Specify whether to overwrite the destination file: yes: overwrites the destination file no: does not overwrite the destination file
Values:
true
false
password
string
Specify the owner or user password of the source PDF document, if it exists.
permissions
string
Specify the type of permissions on the PDF document: AllowPrintHigh AllowPrintLow AllowModify AllowCopy AllowAdd AllowSecure AllowModifyAnnotations AllowExtract AllowFillIn all none Except for all or none, you can specify a comma separated list of permissions. (optional)
Values:
all
allowassembly
allowcopy
AllowDegradedPrinting
AllowFillIn
AllowModifyAnnotations
AllowModifyContents
AllowPrinting
AllowScreenReaders
AllowSecure
none
position
string
Specify the position on the page where the watermark is placed. The position represents the top-left corner of the watermark. Specify the x and y coordinates; for example 50,30.
rotation
numeric
Specify the degree of rotation of the watermark image on the page; for example, 30.
Values:
0
90
180
270
showonprint
string
Specify whether the watermark is printed with the PDF document: yes: the watermark is printed with the PDF document no: the watermark is not printed with the PDF document
Values:
true
false
source
string
Required
Specify the source. The source can be: The pathname to a PDF document; for example, c:\work\myPDF.pdf A PDF document variable in memory that is generated by the cfdocument tag or the cfpdf tag; for example, #myPDFdoc# The binary content of PDF document variable.
type
string
(extracttext) The format of the extracted text: string or xml.
CF 2016+ (export, import) What to export or import: comment (as XFDF) or metadata (as XMP).
Values:
string
xml
comment
metadata
version
string
(write) Specify the version of the PDF document to write.
Values:
1.1
1.2
1.3
1.4
1.5
1.6
transparent
boolean
Default:false
Specifies whether the image background is transparent or opaque: format=png only * yes: the background is transparent. * no: the background is opaque.
Values:
true
false
resolution
string
Image quality used to generate thumbnail images: * high: use high resolution (uses more memory). * low: use low resolution.
Values:
high
low
stoponerror
boolean
Default:false
Valid only if the directory attribute is specified. If the specified directory contains files other then ColdFusion-readable PDF files, ColdFusion either stops merge process or continues. * yes: stops the merge process if invalid PDF files exist in the specified directory. * no: continues the merge process even if invalid files exist in the specified directory.
Values:
true
false
inputfiles
struct
Structure that maps the PDF source files to the input variables in the DDX file, or a string of elements and their pathname.
scale
numeric
Size of the thumbnail relative to the source page. The value represents a percentage from 1 through 100.
imageprefix
string
Prefix used for each image thumbnail file generated. The image filenames use the format: imagePrefix_page_n.format.
outputfiles
struct
Structure that contains the output files in the DDX file or string as keys and the pathname to the result file as the value.
pages
string
Page or pages in the source PDF document on which to perform the action. You can specify multiple pages and page ranges as follows: "1,6-9,56-89,100, 110-120".
ddxfile
string
Owner or user password of the source PDF document, if the document is password-protected.
saveoption
string
Default:full
Save options for the PDF output: * full: normal save (default) * incremental: required to save modifications to a signed PDF document. * linear: for faster display.
Values:
full
incremental
linear
format
string
Default:jpg
File type of thumbnail image output
Values:
jpg
tiff
png
hires
boolean
Sets a high resolution for the thumbnail if set to yes.
Values:
true
false
maxScale
numeric
Specifies the maximum scale of the thumbnail
maxBreadth
numeric
CF 9+ Specifies maximum width of the thumbnail
maxLength
numeric
Specifies the maximum length of the thumbnail
compressTIFFs
boolean
Compress thumbnail which are in TIFF format.
Values:
true
false
overridepage
boolean
Specify whether to override page or not
Values:
true
false
package
boolean
Create PDF packages
Values:
true
false
hScale
numeric
Horizontal scale of the image to be modified. Valid values are hscale<1.
vScale
numeric
Vertical scale of the image to be modified. Valid values are vscale>0.
noBookMarks
boolean
CF 9+ Remove bookmarks from PDF document
Values:
true
false
noAttachments
boolean
CF 9+ Removes all attachments from PDF documents.
Values:
true
false
noComments
boolean
Remove comments from PDF document
Values:
true
false
noJavaScripts
boolean
CF 9+ Remove all document level JavaScript actions
Values:
true
false
noLinks
boolean
Remove external cross-references
Values:
true
false
noMetadata
boolean
CF 9+ Remove document information and metadata
Values:
true
false
noThumbnails
boolean
Remove embedded page thumbnails
Values:
true
false
noFonts
boolean
CF 9+ Remove font styling
Values:
true
false
algo
string
CF 9+ Specifies the algorithm for image downsampling.
Values:
Bicubic
Bilinear
Nearest_Neighbour
topMargin
numeric
Specifies the value of the top margin
leftMargin
numeric
Specifies the value of the left margin
rightMargin
numeric
Specifies the value of the right margin
bottomMargin
numeric
Specifies the value of the bottom margin
numberFormat
string
Specify the numbering format for PDF pages in the footer.
Values:
NUMERIC
LOWERCASEROMAN
UPPERCASEROMAN
align
string
Aligns the header and footer in PDF.
Values:
right
left
center
honourspaces
boolean
Set this option to "true" if you need characters to be converted to spaces.
Values:
true
false
addQuads
boolean
Add the position or quadrants of the thumbnail
Values:
true
false
text
string
Specify Text Value
Values:
_PAGELABEL
_LASTPAGELABEL
_PAGENUMBER
_LASTPAGENUMBER
useStructure
boolean
CF 9+ Specify whether to use structure or not
Values:
true
false
jpgdpi
numeric
CF 9+
encodeAll
boolean
Encode streams that are not encoded to optimize page content
Values:
true
false
exportTo
string
CF 2016+ (export) Path of the file to export to: an XFDF file when type is comment, or an XMP file when type is metadata.
importFrom
string
CF 2016+ (import) Path of the file to import: an XFDF file when type is comment, or an XMP file when type is metadata.
standard
string
CF 2016+ (archive) The PDF/A conformance level to archive to, for example 2b or 3b.
filename
string
CF 2016+ (addAttachments) File name for the attachment. Usually set on the cfpdfparam tag.
encoding
string
CF 2016+ (addAttachments, getAttachments) Encoding of the attachment file name. Usually set on the cfpdfparam tag.
description
string
CF 2016+ (addAttachments) Descriptive text for the attachment. Usually set on the cfpdfparam tag.
mimetype
string
CF 2016+ (addAttachments) MIME type of the attachment, for example application/pdf or text/html. Usually set on the cfpdfparam tag.
keystore
string
CF 11+ (sign) Location of the keystore file, for example C:\OpenSSL\bin\keystore.jks. Required for the sign action.
keystorePassword
string
CF 11+ (sign) Password of the keystore. Required for the sign action.
keyAlias
string
CF 11+ (sign) Alias of the key that holds the certificate and private key in the keystore. Defaults to the first entry in the keystore.
keyPassword
string
CF 11+ (sign) Password for the private key. Defaults to keystorePassword.
author
boolean
Default:false
CF 11+ (sign) true to create an author (certifying) signature, which lets recipients verify who signed the document and that it has not been altered.
Values:
true
false
signatureFieldName
string
CF 11+ (sign, unsign) Fully qualified name of the existing signature field to sign or unsign.
unsignAll
boolean
CF 11+ (unsign) true to remove all signatures from the document.
Values:
true
false
height
numeric
CF 11+ (sign) Height of the signature field. Also accepted by addWatermark.
width
numeric
CF 11+ (sign) Width of the signature field. Also accepted by addWatermark.
charset
string
(extracttext) not documented
extract
string
(getAttachments) not documented
nameKeys
string
(getAttachments) not documented
attachment
string
(addWatermark) not documented
targetPage
string
(addWatermark) not documented
title
string
(addWatermark) not documented
Compatibility
ColdFusion:
Version 8+
CF9+ Added new attributes: jpgdpi, maxBreadth, noAttachments, leftMargin, algo, noMetadata, noBookMarks, noJavaScripts, useStructure, noFonts.
CF11 added validatesignature and readsignaturefields, and the signing attributes keystore, keystorepassword, keyalias, keypassword, author, signaturefieldname, unsignall, height and width. CF2016 added the actions sanitize, export and import (comments and metadata), archive, addAttachments, addStamp and redact, and the AES_256R5 and AES_256R6 encryption algorithms.
Examples
Sample code using the cfpdf tag
Add an Example for: cfpdf
Use this form to create the Serialized JSON string needed to add an example into the docs.