Whatever message this page gives is out now! Go check it out!
Add a watermark to a PDF document
<cfpdf
required
action = "addwatermark"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
one of the following:
copyfrom = "absolute or relative pathname to a PDF file from which the first page is
used as a watermark"
image = "absolute or relative pathname to image file|image variable used as a
watermark"
optional
foreground = "yes|no"
isBase64 = "yes|no"
opacity = "watermark opacity"
overwrite = "yes|no"
pages = "page or pages to add the watermark"
password = "user or owner password for the PDF source file"
position = "position on the page where the watermark is placed"
rotation = "degree of rotation of the watermark"
showonprint = "yes|no">
// one of the following:
destination = "PDF output file pathname"
name = "PDF document variable name"
image = "image file name to be used as the footer"
text = "text to be used in the footer"
<!--- action=sanitize --->
<cfpdf
// required
action="sanitize"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
// Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”>
<!--- end syntax --->
<!--- action=export comments --->
<cfpdf
// required
action="export"
type="comment"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
exportTo = "destination of xfdf file">
<!--- end syntax --->
<!--- action=import comments --->
<cfpdf
// required
action="import"
type="comment"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
importFrom = "source of xfdf file"
// Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”>
<!--- end syntax --->
<!--- action=export metadata --->
<cfpdf
// required
action="export"
type="metadata"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
exportTo = "destination of xmp file">
<!--- end syntax --->
<!--- action=import metadata --->
<cfpdf
// required
action="import"
type="metadata"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
importFrom = "source of xmp file"
// Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”>
<!--- end syntax --->
<!--- action=archive --->
<cfpdf
// required
action="archive"
source="#sourcefilename#"
// Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”>
// optional
standard = "3b"/>
<!--- end syntax --->
<!--- action=addAttachments --->
<cfpdf
// required
action="addAttachments"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable|directory path"
// Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”
<cfpdfparam
// required
source= "path of attachment"
filename = "filename for the attachment"
encoding = "encoding for filename" >
// optional
description = "descriptive text"
mimetype = "eg: application/pdf, text/html">
>
<!--- end syntax --->
<!--- action=addStamp --->
<cfpdf
// required
action="addStamp"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
// Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”>
<cfpdfparam
pages = "page number|page range|comma-separated page numbers"
<!--- It is recommended that that ratio of the stamp width:height is
10:3 --->
coordinates = "llx,lly,urx,ury"
iconName = "name of icon"
note = "content of stamp" >
>
<!--- end syntax --->
Add headers
<cfpdf
required
action = "addheader"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
pages = "page or pages to add the footer"
optional
isBase64 = "yes|no"
overwrite = "yes|no"
password = "user or owner password for the PDF source file"
showonprint = "yes|no">
align = "left|right|center"
leftmargin = "value of the header left marign"
rightmargin = "value of the header right margin"
numberformat = "LOWERCASEROMAN|NUMERIC|UPPERCASEROMAN" <!---used with either
_PAGENUMBER or _LASTPAGENUMBER--->
opacity = "header opacity"
topmargin = "value of the top margin of the header"
\\one of the following:
destination = "PDF output file pathname"
name = "PDF document variable name"
text = _PAGELABEL: add current page label|_LASTPAGELABEL: add last page label|
_PAGENUMBER: add current page number|_LASTPAGENUMBER: add last page
number \\text for the header. You can also add a normal text string.
image = "image file name to be used as the header"
Add footer
<cfpdf
required
action = "addfooter"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
pages = "page or pages to add the footer"
optional
isBase64 = "yes|no"
overwrite = "yes|no"
password = "user or owner password for the PDF source file"
showonprint = "yes|no">
destination = "PDF output file pathname"
name = "PDF document variable name"
align = "left|right|center"
one of the following:
image = "image file name to be used as the footer"
text = _PAGELABEL: add current page label|_LASTPAGELABEL: add last page label|
_PAGENUMBER: add current page number|_LASTPAGENUMBER: add last page
number \\text for the header
leftmargin = "value of the footer left marign"
rightmargin = "value of the footer right margin"
numberformat
opacity = "footer opacity"
bottommargin = "value of the bottom margin"
Delete pages from a PDF document
<cfpdf
required
action = "deletepages"
pages = "page or pages to delete"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
optional
overwrite = "yes|no"
password = "PDF source file password"
one of the following:
destination = "PDF output file pathname"
name = "PDF document variable name">
Delete headers and footers
<cfpdf
required
action = "removeheaderfooter"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
optional
overwrite = "yes|no"
pages = "page or pages to add the watermark"
password = "user or owner password for the PDF source file"
one of the following:
destination = "PDF output file pathname"
name = "PDF document variable name"
Retrieve information about a PDF document
<cfpdf
required
action = "getinfo"
name = "structure variable name"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
optional
password = "PDF source file password">
Merge PDF documents into an output PDF file
<cfpdf
required
action = "merge"
one of the following:
directory = "directory of PDF files to merge"
source = "comma-separated list of PDF source files|absolute or relative pathname
to a PDF file|PDF document variable|cfdocument variable"
<cfpdfparam>
\\required only when package is specified as true
order = "name|time"
one of the following if <cfpdfparam> is specified:
name = "PDF document variable name"
destination = "PDF output file pathname"
optional
package = "true|false" <!---create PDF packages if set to true. You can provide
description in cfpdfparam tag, such as <cfpdfparam file="filename desc="">--->
ascending = "yes|no"
keepBookmark = "yes|no"
overwrite = "yes|no"
pages = "pages to merge in PDF source file"
password = "PDF source file password"
stopOnError = "yes|no"
\\one of the following:
destination = "PDF output file pathname"
name = "PDF document variable name">
Use DDX instructions to manipulate PDF documents
<cfpdf
required
ddxfile = "DDX filepath|DDX string"
inputfiles = "#inputStruct#"
outputfiles = "#outputStruct#"
name = "structure name">
optional
action="processddx"
Set passwords and encrypt PDF documnets
<cfpdf
required
action = "protect"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
at least one of the following:
newUserPassword = "password"
newOwnerPassword = "password"
if newOwnerPassword is specified:
permissions = "All|AllowAssembly|AllowDegradedPrinting|AllowCopy|AllowFillIn|
AllowModifyAnnotations|
AllowModifyContents|AllowPrinting|AllowScreenReaders|AllowSecure|None|
comma-separated list"
optional
destination = "PDF output file pathname"
encrypt = "RC4_40|RC4_128|RC4_128M|AES_128|AES_256R6|AES_256R5|none"
overwrite = "yes|no"
password = "source file password">
Name a PDF document variable
<cfpdf
required
action = "read"
name = "PDF document variable name"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
optional
password = "PDF source file password">
Remove a watermark from a PDF document
<cfpdf
required
action = "removeWatermark"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
optional
overwrite = "yes|no"
pages = "page or pages from which to remove the watermark"
password = "PDF source file password">
one of the following:
destination = "PDF output file pathname"
name = "PDF document variable name"
Set information about a PDF document
<cfpdf
required
action = "setinfo"
info = "#structure variable name#"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
optional
destination = "PDF output file pathname"
overwrite = "yes|no"
password = "PDF source file password">
Generate thumbnails from pages in a PDF document
<cfpdf
required
action = "thumbnail"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
optional
destination = "directory path where the thumbnail images are written"
format = "png|jpeg|tiff"
imagePrefix = "string used as a prefix in the output filename"
overwrite = "yes|no"
password = "PDF source file password">
pages = "page or pages to make into thumbnails"
resolution= "low|high"
scale = "percentage between 1 and 100"
transparent = "yes|no">
hires = "yes|no"
overridepage = "yes|no"
compresstiffs = "yes|no"
maxscale = "maximum scale of the thumbnail"
maxlength = "maximum length of the thumbnail"
maxbreadth = "maximum width of the thumbnail"
jpgdpi = "sets the dpi (dots per inch) value of the jpeg image. The default value is 96 dpi."
Write a PDF document to an output file
<cfpdf
required
action = "write"
source = "absolute or relative pathname to a PDF file|PDF document variable|
cfdocument variable"
\\one of the following
destination = "PDF output file pathname"
name = #PDF variable# <!---new variable support added now--->
optional
flatten = "yes|no"
overwrite = "yes|no"
password = "PDF source file password"
saveOption = "linear|incremental|full"
version = "1.1|1.2|1.3|1.4|1.5|1.6">
encodeall = "yes|no"
Reduce the quality of a PDF document
<cfpdf
required
action = "optimize"
source = "absolute or relative path of the PDF file|PDF document variable|
cfdocument variable"
algo = "bilinear|bicubic|nearest_neighbour" <!---algorithm for image
downsampling--->
pages = "*" <!----page numbers associated with the objects in the PDF document--->
optional
vscale= "Vertical scale of the image to be modified. Valid values are vscale>0"
hscacle="Horizontal scale of the image to be modified. Valid values are hscale<1"
destination = "PDF output file pathname"
name = "PDF document variable"
noattachments = "Discard all attachments"
nobookmarks = "Discard all bookmarks"
nocomments = "Discard all comments"
nofonts = "Discard all fonts"
nojavascripts = "Discard all JavaScript actions"
nolinks = "Discard external cross-references"
nometadata = "Discard document information and metadata"
nothumbnails = "Discard embedded page thumbnails"
overwrite = "true" <!---Overwrite the specified object in the PDF document--->
password = "" <!--- PDF document password--->
Extract text
<cfpdf
required
action="extracttext" <!---extract all the words in the PDF.--->
source= "absolute or relative path of the PDF file|PDF document variable|
cfdocument variable"
pages = "*" <!----page numbers from where the text needs to be extracted from the
PDF document--->
optional
addquads = "add the position or quadrants for the text in the PDF"
honourspaces = "true|false"
overwrite = "true" <!---Overwrite the specified object in the PDF document--->
password = "" <!--- PDF document password--->
type = "string|xml" <!---format in which the text needs to be extracted--->
one of the following:
destination = "PDF output file pathname"
name = "PDF document variable"
usestructure = "true|false"
Extract image
<cfpdf
required
action = "extractimage" <!---extract images and save it to a directory--->
source = "absolute or relative path of the PDF file|PDF document variable|
cfdocument variable"
pages = "*" <!---page numbers from where the images need to be extracted--->
optional
overwrite = "true|false" <!---overwrite any existing image when set to true--->
format = "png|tiff|jpg" <!---format in which the images should be extracted--->
imageprefix = "*" <!---the string that you want to prefix with the image
name--->
password = "" <!--- PDF document password--->
destination = "PDF output file pathname"
Page level transformations
<cfpdf
required
action = "transform"
source = "absolute or relative path of the PDF file|PDF document variable|
cfdocument variable"
pages = "page or pages to be transformed"
optional
hscale = "value of the horizontal scale of the page"
overwrite = "yes|no"
password = "PDF source file password"
position = "x, y" <!---value in pixels--->
rotation = "0|90|180|270"
vscale = "length of the page to be transformed"
one of the following:
destination = ""Path of the directory where the PDF document will be saved"
name = "PDF document variable"
// redact
<cfpdf action="redact" source="source PDF document" destination="destination PDF document" overwrite="true | false">
<cfpdfparam pages="from page-to page" coordinates="llx,lly,urx,ury">
</cfpdf>Attribute | Action | Req/Opt | Description |
action | N/A | Optional | Action to take: archive addAttachments addStamp addWatermark deletePages export getInfo import merge processddx protect read removeWatermark sanitize setInfo sign thumbnail write optimize extracttext extractimage addheader addfooter removeheaderfooter transform unsign validatesignature New in ColdFusion 11–Validates all the signatures in the document. The name attribute will then store the resultant struct of this operation. The name attribute will contain 2 elements:
readsignaturefields New in ColdFusion 11–Reads all the signature fields and returns a query object in the variable indicated by the attribute name. This query object will have 4 columns:
New in ColdFusion 2016:
|
addquads | extracttext | Optional | Add the position or quadrants of the thumbnail |
align | addheader addfooter | Optional | Aligns the header and footer in PDF. |
algo | optimize | Required | Specifies the algorithm for image downsampling. The values are bilinear, bicubic, and nearest_neighbour |
ascending | merge | Optional | Order in which the PDF files are sorted: yes: Files are sorted in ascending order no: Files are sorted in descending order Applicable only when you specify the directory attribute. |
author | sign | Optional | Business transactions, including financial, legal, and other regulated transactions, require high assurance when signing documents. When documents are distributed electronically, it is important that recipients can: Verify document authenticity – confirm the identity of person who signed the document Verify document integrity – confirm that the document has not been altered in transit Author-based signatures provide both of these security services. If attribute is not mentioned then it is treated as author=false |
bottomMargin | addfooter | Optional | Specifies the value of the bottomMargin |
copyFrom | addWatermark | Optional | Pathname of the PDF document from which to use the first page as a watermark |
compresstiffs | thumbnail | Optional | Compress thumbnail which are in TIFF format. |
ddxfile | processddx | Required | Pathname of the DDX file, or a string with DDX instructions |
destination | addWatermark archive deletePages merge protect removeWatermark sign setInfo thumbnail write optimize extracttext extractimage addheader addfooter removeheaderfooter transform | Required for the write action Optional for all other actions | Pathname of the modified PDF document. If the destination file exists, set the overwrite attribute to yes. If the destination file does not exist, ColdFusion creates the file, if the parent directory exists. You can specify the destination attribute or the name attribute, but not both. For the thumbnail action, the destination is the directory path where the images are written. If you specify a relative pathname to the destination directory, the destination directory is relative to the template directory. If you do not specify a destination directory, ColdFusion creates a directory called thumbnails in the directory in the template directory. For the optimize action, destination is the path where the PDF document which needs to be optimized is located. For extracttext and extractimage , destination is the path of the PDF document from which the text or image needs to be extracted. For addheader , addfooter , removeheader footer, destination is the path of the PDF document where you need to add a header or footer, or remove the header and footer. For transform, destination specifies the directory path of the PDF document where you need to perform page level transformations. |
directory | merge | Optional | Directory of the PDF documents to merge. Specify either the directory attribute or the source attribute. If you specify the directory attribute, ColdFusion orders the documents by filename in descending order, by default. To change the order of the files, use the order attribute. |
encodeall | write | Optional | Encode streams that are not encoded to optimize page content |
encrypt | protect | Optional | Encryption type for the PDF output file. In ColdFusion 2016, there is support for two new encryption algorithms, AES_256R6 and AES_256R5.
Note: The JRE must have "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" installed. This is only required for the new encryption algorithms. For more information, see the section Encryption for PDF documents. |
flatten | write | Optional | Applies to forms created in Acrobat only (not forms created in LiveCycle); specifies whether interactivity is turned off: yes: the form fields are no longer interactive. no: the form fields remain interactive. |
foreground | addWatermark | Optional | Placement of the watermark on the page: yes: the watermark appears in the foreground (over the page content). no: the watermark appears in the background (behind the page content). |
format | thumbnail | Optional | File type of thumbnail image output: jpg tiff png |
hires | thumbnail | optional | Sets a high resolution for the thumbnail if set to yes. |
height | sign | Optional | Height of the signature field. |
honourspaces | extracttext | optional | Set this option to "true", for improved readability and spacing. |
hscale | optimize | optional | Horizontal scale of the image to be modified. Valid values are hscale<1. |
image | addWatermark | Optional | Image used as a watermark. You can specify a pathname, a variable that contains an image file, or a ColdFusion image variable. |
imagePrefix | thumbnail | Optional | Prefix used for each image thumbnail file generated. The image filenames use the format: imagePrefixpagen.format. For example, the thumbnail for page 1 of a document with the imagePrefix attribute set to myThumbnail is myThumbnail_page_1.jpg. |
info | setInfo | Required | Structure variable for relevant information, for example, " #infoStruct#" . You can specify the Author, Subject, Title, and Keywords for the PDF output file. |
inputFiles | processddx | Required | Structure that maps the PDF source files to the input variables in the DDX file, or a string of elements and their pathname. |
isBase64 | addWatermark | Optional | Valid only when the image attribute is specified. Specifies whether the image used as a watermark is in Base64 format: yes: the image is in Base64 format. no: the image is not in Base64 format. |
jpgdpi | addThumbnail | Optional | Sets the DPI of the jpeg image. Default is 96 dpi. |
keepBookmark | merge | Optional | Specifies whether bookmarks from the source PDF documents are retained in the merged document: yes: the bookmarks are retained. no: the bookmarks are removed. |
keyalias | sign | Optional | Alias of the key with which the certificate and private key are stored in the keystore . If it is not specified, the first entry in the keystore is chosen as the alias. |
keystore | sign | Required | The location of the keystore file. For example, C:\OpenSSL\bin\keystore.jks. |
keypassword | sign | Optional | Password for your private key. If not specified the keystorepassword is used. |
keystorepassword | sign | Required | The password of the keystore . |
leftmargin | addheader | Optional | Specifies the value of the header left margin |
maxbreadth | thumbnail | Optional | Specifies maximum width of the thumbnail |
maxlength | thumbnail | Optional | Specifies the maximum length of the thumbnail |
maxscale | thumbnail | Optional | Specifies the maximum scale of the thumbnail |
name | addWatermark deletePages getInfo merge processddx protect read readsignaturefields removeWatemark write tranform addheader addfooter removeheaderfooter | Required: getInfo processddx read readsignaturefields Optional: addWatermark deletePages merge protect removeWatermark tranform addheader addfooter removeheader footer | PDF document variable name, for example, myBook. 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. You can specify the destination attribute or the name attribute, but not both. For the processddxaction , the name represents the structure that is populated with the success or failure of the output variables. For the readsignaturefields action, the name represents the structure thats is populated with the info of all the signature fields in the source PDF document. |
newOwner Password | protect | Optional (see Description) | Password used to set permissions on a PDF document. To change the default permissions, specify the newOwnerPassword attribute. For more information, see the section PDF document passwords. |
newUser Password | protect | Optional (see Description) | Password used to open PDF document.Specify either the newUserPassword attribute or a newOwnerPassword attribute; if you specify both, the passwords must differ. For more information, see the section PDF document passwords. |
noattachments | thumbnail | Optional | Removes all attachments from PDF documents. |
noattachments | optimize | Optional | Remove all file attachments |
nobookmarks | optimize | Optional | Remove bookmarks from PDF document |
nocomments | optimize | Optional | Remove comments from PDF document |
nofonts | optimize | Optional | Remove font styling |
nojavascripts | optimize | Optional | Remove all document level JavaScript actions |
nolinks | optimize | Optional | Remove external cross-references |
nometadata | optimize | Optional | Remove document information and metadata |
nothumbnails | optimize | Optional | Remove embedded page thumbnails |
numberformat | addfooter | Optional | Specify the numbering format for PDF pages in the footer. |
opacity | addWatermark addheader addfooter | Optional | Opacity of the watermark. Valid values are integers in the range 0 (transparent) through 10 (opaque). |
order | merge | Optional | Order in which the PDF documents in the directory are merged: name: orders the documents alphabetically by filename. time: orders the documents by timestamp. By default, ColdFusion merges the files in descending order (for example, from Z to A). To change this, set the ascending attribute to yes. |
outputFiles | processddx | Required | Structure that contains the output files in the DDX file or string as keys and the pathname to the result file as the value. |
overwrite | addSign addWatermark archive deletePages merge protect removeWatermark Sign setInfo thumbnail write tranform addheader addfooter removeheaderfooter | Optional | Specifies whether PDF output overwrites the destination file: yes: overwrites the destination file. no: does not overwrite the destination file. For the thumbnail action, specifies whether to overwrite the destination directory. If the directory exists, the thumbnails are not generated unless overwrite is set to yes. |
package | merge | Optional | Create PDF packages |
pages | addWatermark deletePages merge removeWatermark optimize extracttext extractimage sign addheader addfooter removeheaderfooter transform | Required: deletePages Optional: addWatermark merge removeWatermark thumbnail optimize extractext extractimage tranform addheader addfooter removeheader footer | 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". For the removeWatermark action, the pages attribute applies only to the watermark type. ColdFusion ignores duplicate pages and numbers greater than the total page count. For action=sign, value of attribute pages should consist of just one page number. |
password | addWatermark addSign archive deletePages getInfo merge protect read readsignaturefields removeWatermark setInfo sign thumbnail unsign write optimize extracttext extractimage addheader addfooter removeheaderfooter validatesignaturefields transform | Optional | Owner or user password of the source PDF document, if the document is password-protected. |
permissions | protect | Optional | Type of permissions on the PDF document: All AllowAssembly AllowCopy AllowDegradedPrinting AllowFillIn AllowModifyAnnotations AllowModifyContents AllowPrinting AllowScreenReaders AllowSecure None Except for All or None, you can specify a comma-separated list of permissions. To set permissions, you must also set the newOwnerPassword attribute. |
position | addWatermark sign | Optional | The position attribute is the coordinate of the lower left corner of the signature field. |
resolution | thumbnail | Optional | Image quality used to generate thumbnail images: high: use high resolution (uses more memory). low: use low resolution. |
rotation | addWatermark transform | Optional | Degree of rotation of the watermark image on the page, for example, "30". |
saveOption | write | Optional | Save options for the PDF output: full: normal save (default) incremental: required to save modifications to a signed PDF document. linear: for faster display. |
scale | thumbnail | Optional | Size of the thumbnail relative to the source page. The value represents a percentage from 1 through 100. |
showOnPrint | addWatermark | Optional | Specify whether to print the watermark with the PDF document: yes: the watermark is printed with the PDF document. no: the watermark is display-only. |
signature fieldname | sign unsign | Optional | Name of signature field in which the user wants to sign or the name of the signature field that the user wants to unsign. |
source | archive addWatermark deletePages getInfo merge protect read removeWatermark setInfo sign thumbnail write optimize extracttext extractimage addheader addfooter removeheaderfooter unsign transform | Required (see Usage section for merge) | PDF document used as the source. The source can be one of the following: An absolute or relative pathname to a PDF document, for example, c:\work\myPDF.pdf or myPDF.pdf. A PDF document variable in memory that is generated by the cfdocument tag or the cfpdf tag, for example, " myPDFdoc". |
stopOnError | merge | Optional | Valid only if the directory attribute is specified. If the specified directory contains files other than 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. |
transparent | thumbnail | Optional | (format="png" only) Specifies whether the image background is transparent or opaque: yes: the background is transparent. no: the background is opaque. |
unsignall | unsign | Optional | Unsigns all the signatures in the document. |
useStructure | extracttext | Optional | Let's you extract content based on the PDF structure. For better readability of the extracted text, use this attribute together with the attribute honourspaces . |
version | write | Optional | Version of the PDF used to write the document: 1.1 1.2 1.3 1.4 1.5 1.6 For more information, see the section PDF versions. |
width | sign | optional | Width of the signature field. |
<!--- Use the cfdocument tag to create a cover page and write the output to a variable called
cfdoc. --->
<cfdocument format="PDF" name="cfdoc">
<html>
<body>
<h1>Here is a cover page</h1>
</body>
</html>
</cfdocument>
<!--- Use the cfpdf tag and cfpdfparam tags to merge individual PDF documents into a new PDF document called new.pdf. Notice that the cfdoc variable created by using the cfdocument tag is the source value of the first cfpdfparam tag. --->
<cfpdf action="merge" destination="/samtemp/pdfs/new.pdf" overwrite="yes">
<cfpdfparam source="cfdoc">
<cfpdfparam source="/samtemp/pdfs/pdf2.pdf">
<cfpdfparam source="/samtemp/pdfs/pdf1.pdf">
</cfpdf>Task | Attributes | Example |
Overwrite a source PDF file | Specify the PDF file pathname as the source and do not specify a destination. | <cfpdf action="addWatermark" source="myPDF.pdf" image="myImage.jpg"> |
Write a PDF document in memory to a file | Specify the PDF variable as the source and a PDF file pathname for the destination. | <cfpdf action="addWatermark" source="myPDF" image="myImage.jpg" destination="outputFile.pdf"> |
Write a PDF document to a new file | Specify a PDF file pathname as the source and a different PDF file pathname as the destination. | <cfpdf action="addWatermark" source="sourceFile.pdf" image="myImage.jpg" destination="outputFile.pdf"> |
Write a PDF file to a PDF variable | Specify the PDF file pathname as the source and a PDF variable name. | <cfpdf action="addWatermark" source="sourceFile.pdf" image="myImage.jpg" name="myPDF"> |
Overwrite a PDF document in memory | Specify the PDF variable name as the source and do not specify a destination. | <cfpdf action="addWatermark" source="myPDF" image="myImage.jpg"> |
<cfpdf action="addWatermark" source="c:\myBook.pdf" copyFrom="e:\yourBook.pdf"
destination="ourBook.pdf" overwrite="yes"><cfpdf action="addWatermark" source="Book.pdf"
image="../cfdocs/images/artgallery/paul01.jpg" destination="newBook.pdf" pages="1"
overwrite="yes"><!--- Use the ImageNew function to create a ColdFusion image from a JPEG file. --->
<cfset myImage=ImageNew("../cfdocs/images/artgallery/jeff05.jpg")>
<!--- Use the ImageGrayscale function to convert the image to grayscale in memory. --->
<cfset ImageGrayscale(myImage)>
<!--- Specify the image variable to apply the grayscale image as a watermark in the Book.pdf file. Because the source and destination are the same and the overwrite attribute is set to yes, ColdFusion overwrites the source file. --->
<cfpdf action="addWatermark" source="Book.pdf" destination="Book.pdf" overwrite="yes" image="#myImage#"><cfpdf action = "addfooter"
source = "../myBook.pdf"
destination = "../myBookwithfooter.pdf"
image = "adobelogo.JPG" // Use this attribute to add an image in the
footer
align = "right"> // By default, the alignemnt is center<cfpdf action = "addheader"
source = "../myBook.pdf"
destination = "../myBookwithheader.pdf"
text = "Adobe"
align = "left"><cfpdf action="deletePages" source="c:\myBook.pdf" pages="1,16-32,89,100-147"
destination="myLittleBook.pdf"><cfpdf action = "extracttext" source = "../myBook.pdf" pages = "5-20, 29, 80" destination = "../adobe/textdoc.txt"<cfpdf action = "extractimage" source = "../myBook.pdf" pages = "1-200" destination = "..\mybookimages" imageprefix = "mybook"><cfpdf action="getInfo" source="myBook.pdf" name="PDFInfo">
<p><cfoutput>#PDFInfo.title#</cfoutput></p>
<p><cfoutput>#PDFInfo.author#</cfoutput></p>
<p><cfoutput>#PDFInfo.keywords#</cfoutput></p>
<p><cfoutput>#PDFInfo.created#</cfoutput></p><cfdump var="#PDFInfo#"><cfpdf action = "optimize" algo = "bicubic" source "..\myBook.pdf" name = #mybook#><cfpdf action = "optimize"
noJavaScripts
noThumbnails
noBookmarks
noComments
noMetadata
noFileAttachments
noLinks
nofonts><cfpdf action = "transform"
required
source = "..\myBook.pdf"
optional
destination = "..\new\myBook.pdf">
hscale = ".5"
vscale = ".15"
position = "8, 10"
rotation = "180">Element | Example | Description |
Application | Acrobat PDFMaker 7.0.7 for Word | Application used to create the PDF document. This value is read-only. |
Author | Harper Lee | Author of the PDF document. You can specify a text string with the setInfo action. |
CenterWindowOnScreen | empty string | Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element. |
ChangingDocument | Not Allowed | Permissions assigned for editing the PDF content. To change this setting, use the permissions attribute with the protect action. |
Commenting | Allowed | Permissions assigned for adding comments to the PDF document. To change this setting, use the permissions attribute with the protect action. |
ContentExtraction | Allowed | Permissions assigned for extracting content from the PDF document. To change this setting, use the permissions attribute with the protect action. |
CopyContent | Allowed | Permissions assigned for copying content from the PDF document. To change this setting, use the permissions attribute with the protect action. |
Created | D:20061121155226-05'00' | System-generated creation date of the PDF document. You can specify a text string with the setInfo action. |
DocumentAssembly | Not Allowed | Permissions assigned for merging the PDF document with other PDF documents. To change this setting, use the permissions attribute with the protect action. |
Encryption | Password Security | Specifies whether the PDF file is password-protected. To change the encryption algorithm, or add a password, use the protect action. |
FilePath | C:\ColdFusion\wwwroot\lion\myDoc.pdf | Absolute pathname for the PDF file. This value is read-only. |
FillingForm | Allowed | Permissions assigned for entering data in form fields. To change this setting, use the permissions attribute with the protect action. |
FitToWindow | empty string | Display setting for initial view of the PDF document. To change this setting use the processddx action with the InitialViewProfile DDX element. |
HideMenubar | empty string | Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element. |
HideToolbar | empty string | Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element. |
HideWindowUI | empty string | Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element. |
Keywords | marketing, sales, production | Keywords specified for searches in the PDF document. You can specify a comma-separated list of keywords with the setInfo action. |
Language | EN-US | Language version used to create the source file for the PDF document. This value is read-only. |
Modified | D:20061121155226-06'00' | System-generated timestamp for when the PDF file was last modified. You can specify a text string with the setInfo action |
PageLayout | OneColumn | Display setting for the initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element. |
Printing | Allowed | Permissions assigned for printing the document. To change this setting, use the permissions attribute with the protect action. |
Producer | Acrobat Distiller 7.0.5 (Windows) | Version of Acrobat Distiller used to generate the PDF document. This value is read-only. |
Properties | empty string | This value is read-only. |
Secure | Not Allowed | Display setting that shows whether the PDF document is password protected. |
ShowDocumentsOption | empty string | Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element. |
ShowWindowsOption | empty string | Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element. |
Signing | Allowed | Permissions for allowing electronic signatures to the PDF document. To change this setting, use the permissions attribute with the protect action. |
Subject | Product Marketing | The subject assigned to the PDF document. You can specify a text string with the setInfo action. |
Title | Chapter 1: Getting Started | The title assigned to the PDF document. You can specify a text string with the setInfo action. |
TotalPages | 25 | Total pages in the PDF document. This value is read-only. |
Trapped | empty string | Indicates whether trapping is applied to the PDF document. Trapping is used in printing to eliminate gaps between two adjoining ink colors. You can specify a text string with the setInfo action. |
Version | 1.6 | Version of the Adobe PDF generator used to create the PDF document. To change this setting use the version attribute with the write action. For more information, see the section PDF versions. |
<cfpdf action="merge" directory="c:\myPDFfiles" destination="oneBigFile.pdf"
overwrite="yes"><cfpdf action="merge" directory="c:\book" order="name" ascending="yes"
destination="c:\book\output1.pdf" overwrite="yes"><cfpdf action="merge" directory="c:\bookfiles" destination="book.pdf" overwrite="yes"
order="name" ascending="yes" keepBookmark="yes" stopOnError="yes"><cfpdf action="merge" source="myBigBook.pdf" pages="1-5" destination="myShortBook.pdf"
overwrite="yes"><cfpdf action="merge" source="c:\PDFdocs\myBook\Chap1.pdf,
c:\PDFdocs\myBook\Chap2.pdf,c:\PDFdocs\myBook\Chap3,pdf" destination="myBook.pdf"
package = "true" overwrite="yes"><cfpdf action="merge" package="yes" destination="./myBook/adobetest.pdf" overwrite="yes">
<cfpdfparam source="./inputFiles/c.zip" >
<cfpdfparam source="./inputFiles/d.jpg" >
</cfpdf>About | Author | Background |
Center | DatePattern | DDX |
DocumentInformation | DocumentText | Footer |
Header | InitialViewProfile | Keyword |
Keywords | Left | MasterPassword |
Metadata | NoBookmarks | OpenPassword |
PageLabel | Password | PasswordAccessProfile |
PasswordEncryptionProfile | PDF (see Note) | PDFGroup |
Permissions | Right | StyledText |
StyleProfile | Subject | TableOfContents |
TableOfContentsEntryPattern | TableOfContentsPagePattern | Title |
Watermark |
| New in ColdFusion 11 - The following restricted DDX elements are supported in ColdFusion 11 (Enterprise Edition). |
ArtBox | AttachmentAppearance | Bookmarks |
BlankPage | BleedBox | Comments |
Description | FileAttachments | FilenameEncoding |
LinkAlias | Links | NoBackgrounds |
NoComments | NoFileAttchments | NoFooters |
NoForms | NoHeaders | NoLinks |
NoPageLabels | NoThumbnails | NoWatermarks |
NoXFA | PageMargins | PageSize |
PageRotation | PageOverlay | PageUnderlay |
PDFsFromBookmarks | Transform | TrimBox |
<?xml version="1.0" encoding="UTF-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd">
<PDF result="Out1">
<PDF source="Title"/>
<TableOfContents/>
<PDF source="Doc1"/>
<PDF source="Doc2"/>
<PDF source="Doc3"/>
</PDF>
</DDX><!--- The following code verifies that the DDX file exists and the DDX instructions are valid. --->
<cfif IsDDX("Book.ddx")>
<!--- The following code maps the PDF source files to the PDF source variables in the
DDX file. --->
<cfset inputStruct=StructNew()>
<cfset inputStruct.Title="Title.pdf">
<cfset inputStruct.Doc1="Chap1.pdf">
<cfset inputStruct.Doc2="Chap2.pdf">
<cfset inputStruct.Doc3="Chap3.pdf">
<!--- The following code maps the PDF output file to the PDF result variable in the DDX
file. --->
<cfset outputStruct=StructNew()>
<cfset outputStruct.Out1="output.pdf">
<!--- The following code process the DDX instructions in the Book.ddx file to generate
a merged document. --->
<cfpdf action="processddx" ddxfile="Book.ddx" inputfiles="#inputStruct#"
outputfiles="#outputStruct#" name="ddxVar">
<cfelse>
<p>The DDX instructions are not valid.</p>
</cfif>
<!--- The following code displays a success or failure message. --->
<cfoutput>#ddxVar.Out1#</cfoutput><cfdump var="#ddxVar#"><cfpdf action="protect" source="Finances.pdf" destination="myFinances.pdf"
newUserPassword="keepOut"><cfpdf action="protect" encrypt="AES_128"source="Book.pdf" destination="MysteryBook.pdf"
overwrite="yes" newOwnerPassword="pssst" permissions="AllowDegradedPrinting">ColdFusion password | Acrobat equivalent | Description |
User password | Document Open password, user password | Anyone who tries to open the PDF document must enter the password that you specify. A user password does not allow a user to change restricted features in the PDF document. |
Owner password | Permissions password, master password | Lets the person who enters the password restrict access to features in a PDF document. |
<cfpdf action="protect" source="myVar" password="oldpassword"
permissions="none" newuserpassword="newuserpw"
newownerpassword="newownerpw"><cfpdf action="info" source="myVar" name="info"><cfpdf action="info" source="myVar" password=" newuserpw" name="info">Permissions | Description |
All | There are no restrictions on the PDF document. |
AllowAssembly | Users can add the PDF document to a merged document. |
AllowCopy | Users can copy text, images, and other file content. This setting is required to generate thumbnail images with the thumbnail action. |
AllowDegradedPrinting | Users can print the document at low-resolution (150 DPI). |
AllowFillIn | Users can enter data into PDF form fields. Users can sign PDF forms electronically. |
AllowModifyAnnotations | Users can add or change comments in the PDF document. |
AllowModifyContents | Users can change the file content. Users can add the PDF document to a merged document. |
AllowPrinting | Users can print the document at high-resolution (print-production quality). This setting is required for use with the cfprint tag. |
AllowScreenReaders | Users can extract content from the PDF document. |
AllowSecure | Users can sign the PDF document (with an electronic signature). |
None | Users can view the document only. |
<cfpdf action="protect" encrypt="AES_128" source="Book.pdf" destination="MysteryBook.pdf"
overwrite="yes" newOwnerPassword="pssst" permissions="AllowDegradedPrinting">Encryption algorithm | Compatibility | Description |
AES_128 | Adobe Acrobat 7.0 and later | Advanced Encryption Standard (AES) specifies the Rijndael algorithm, a symmetric block cipher that can process data blocks of 128 bits. This is the highest encryption level. This encryption algorithm lets users do the following:
|
RC4_128M | Adobe Acrobat 6.0 and later | RC4 specifies the RSA Security software stream cipher for algorithms such as Secure Sockets Layer (SSL), to protect Internet traffic, and WEP, to secure wireless networks. This encryption algorithm lets users do the following:
|
RC4_128 | Adobe Acrobat 5.0 and later | RC4 128-bit encryption. This encryption algorithm lets users encrypt the document contents, but not the document metadata. |
RC4_40 | Adobe Acrobat 3.0 and later | RC4 40-bit encryption. This is the lowest encryption level. |
None | - | The document is not encrypted. |
<cfif IsPDFFile("Book.pdf")>
<cfpdf action="read" source="Book.pdf" name="myBook">
...
</cfif><cfpdf action="removeWatermark" source="Book.pdf" pages="1" destination="newBook.pdf" overwrite="yes"><cfpdf action = "removeheaderfooter" source="..\mybook.pdf" destination = "new.pdf"><cfset PDFinfo=StructNew()>
<cfset PDFinfo.Title="Make Way for Ducklings">
<cfset PDFinfo.Author="Donald Duck">
<cfset PDFinfo.Keywords="Huey,Dewy,Louie">
<cfset PDFinfo.Subject="Ducks">
<cfpdf action="setInfo" source="chap1.pdf" info="#PDFinfo#" destination="meta1.pdf" overwrite="yes"><cfpdf action="thumbnail" source="myBook.pdf"><cfpdf action="thumbnail" source="myBook.pdf" pages="1" destination="c:\myBook\images"
imagePrefix="Cover" format="png" scale="50" resolution="low"><cfpdf action="thumbnail" source="./WORK/myBook.pdf" destination="./WORK/Testing_CFPDF" overwrite="true" hires="yes"><cfpdf action="thumbnail" source="C:\WORK\myBook.pdf" destination="C:\WORK\Testing_CFPDF" overwrite="true" hires="yes" format="tiff" compresstiffs="yes"><cfpdf action="read" source="Book.pdf" name="myBook">
<cfpdf action="write" source="myBook" destination="myBook1.pdf"
version="1.4"><cfpdf action="read" source="Book.pdf" name="myBook">
<cfpdf action="write" source="myBook" name=#myBook#
version="1.4">PDF version | Compatibility |
1.1 | Acrobat and Adobe Reader 2 |
1.2 | Acrobat and Adobe Reader 3 |
1.3 | Acrobat and Adobe Reader 4 |
1.4 | Acrobat and Adobe Reader 5 |
1.5 | Acrobat and Adobe Reader 6 |
1.6 | Acrobat and Adobe Reader 7 |
<cfpdf action="write" source="myBook" destination="myBook1.pdf" saveOption="linear"
overwrite="yes"><cfpdf action="write" source="myDraft" destination="mySignedDoc.pdf"
saveOption="incremental" overwrite="yes"><cfpdf action="write" source="myAcrobatForm.pdf"
destination="myFlatForm.pdf" flatten="yes" overwrite="yes"><h3>PDF Thumbnail Demo</h3>
<!--- Create a variable for the name of the PDF document. --->
<cfset mypdf="myBook">
<cfset thisPath=ExpandPath(".")>
<!--- Use the getInfo action to retrieve the total page count for the
PDF document. --->
<cfpdf action="getInfo" source="#mypdf#.pdf" name="PDFInfo">
<cfset pageCount="#PDFInfo.TotalPages#">
<!--- Generate a thumbnail image for each page in the PDF source document,
create a directory (if it doesn't already exist) in the web root that is
a concatenation of the PDF source name and the word "thumbnails", and
save the thumbnail images in that directory. --->
<cfpdf action="thumbnail" source="#mypdf#.pdf" overwrite="yes"
destination="#mypdf#_thumbnails" scale=60>
<!--- Loop through the images in the thumbnail directory and generate a link
from each image to the corresponding page in the PDF document. --->
<cfloop index="LoopCount" from ="1" to="#pageCount#" step="1">
<cfoutput>
<!--- Click the thumbnail image to navigate to the page in the PDF
document. --->
<a href="#mypdf#.pdf##page=#LoopCount#" target="_blank">
<img src="#mypdf#_thumbnails/#mypdf#_page_#LoopCount#.jpg"></a>
</cfoutput>
</cfloop><!---- Create an archived pdf from source pdf ---à
<cftry>
<cfpdf action="archive" source="#sourcefilename#" destination="#destinationfilename#" overwrite="true" />
<cfcatch>
<cfoutput>#cfcatch.detail#</cfoutput><br><br>
</cfcatch>
</cftry><!---- Sign a specific pdf by creating a signature field and signing it with authoured signature -->
<cfpdf action="sign"
source="#inputfilepath##inputfilename#"
destination="#signedfilepath##signedfilename#"
keystore="#certpath#cert.pfx" keystorepassword="certpass"
overwrite="true" pages="1" height="100"
width="100" position="100,100" author="false"
/><!---- Sign a specific signature field in a input pdf ---->
<cfpdf action="sign"
source=”#inputfilepath##inputfilename#"
destination="#signedfilepath##signedfilename#"
keystore="#certpath#cert.jks" keystorepassword="password"
overwrite="true" author="true"
signaturefieldname="sign_me"/><cfpdf action="unsign" source="../cfpdf_normalPDFSign.pdf" destination="../results/cfpdf_normalPDFSign.pdf" unsignall="true" overwrite="true"><cfpdf action="validatesignature" source="../cfpdf_normalPDFSign.pdf" name="pdfInfo">
<cfoutput>#pdfInfo.SUCCESS#</cfoutput><!--- Read info about signature fields in a
input pdf in a variable and dump it --->
<cfpdf action="readsignaturefields"
source="#filepath##inputfilename#" name="signinfo"
password="owner" />
<cfdump var=”#signinfo#”/><cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destinationfile="#ExpandPath('file_result.pdf')#">
<cftry>
<cfpdf action="addAttachments" source="#sourcefile#" destination="#destinationfile#" overwrite="true">
<cfpdfparam source="#ExpandPath('file1.txt')#" filename="attachment1.txt" Encoding="ASCII" description="file attachment one">
<cfpdfparam source="#ExpandPath('file2.txt')#" filename="attachment2.txt" Encoding="UTF-16" description="file attachment one"></cfpdfparam>
</cfpdf>
<cfcatch type="any">
<cfdump var="#cfcatch#">
</cfcatch>
</cftry><!--- image as footer --->
<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_footer.pdf')#">
<cfpdf action="addfooter"
source="#sourcefile#"
destination="#destfile#"
image="adobe.png"
overwrite="yes"
>
<!--- text as footer --->
<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_footer.pdf')#">
<cfpdf action="addfooter"
source="#sourcefile#"
destination="#destfile#"
text="This is a sample footer"
align="center"
overwrite="yes"
><!--- text as header --->
<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_header.pdf')#">
<cfpdf action="addheader"
source="#sourcefile#"
destination="#destfile#"
text="This is a sample header"
align="center"
overwrite="yes"
>
<!--- image as header --->
<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_header.pdf')#">
<cfpdf action="addheader"
source="#sourcefile#"
destination="#destfile#"
image="adobe.png"
overwrite="yes"
><cfset sourcefile=ExpandPath('addStamp.pdf')/>
<cfset destinationfile=ExpandPath("addStamp_result.pdf")/>
<cftry>
<cfpdf action="addStamp" source="#sourcefile#" destination="#destinationfile#" overwrite="true">
<cfpdfparam pages="2" coordinates = "397,532,519,564" iconname="Approved" note="stamp1">
<cfpdfparam pages="3-4" coordinates = "397,532,519,564" iconname="Experimental" >
<cfpdfparam pages="5" coordinates = "397,532,519,564" iconname="NotApproved" >
<cfpdfparam pages="6" coordinates = "397,532,519,564" iconname="AsIs" note="stamp2">
<cfpdfparam pages="7-8" coordinates = "397,532,519,564" iconname="Expired" note="stamp3">
<cfpdfparam pages="9" coordinates = "397,532,519,564" iconname="NotForPublicRelease" >
<cfpdfparam pages="10" coordinates = "397,532,519,564" iconname="Confidential" >
<cfpdfparam pages="11" coordinates = "397,532,519,564" iconname="Final" note="stamp4">
<cfpdfparam pages="12" coordinates = "397,532,519,564" iconname="Sold">
<cfpdfparam pages="13" coordinates = "397,532,519,564" iconname="Departmental" note="stamp1">
<cfpdfparam pages="14" coordinates = "397,532,519,564" iconname="Draft">
<cfpdfparam pages="15" coordinates = "397,532,519,564" iconname="ForPublicRelease">
<cfpdfparam pages="16" coordinates = "397,532,519,564" iconname="TopSecret">
<cfpdfparam pages="17" coordinates = "397,532,519,564" iconname="ForComment">
</cfpdf>
<cfcatch name="myvar">
<cfdump var="#myvar#">
</cfcatch>
</cftry><cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_watermark.pdf')#">
<cfpdf action="addwatermark" source="#sourcefile#"
destination="#destfile#"
image="image.png"
pages="1-2"
overwrite="yes"><!--- archive standard=2b --->
<cfset sourcefile="#ExpandPath('hello.pdf')#"/>
<cfset archivedfile="#ExpandPath('Hello_archived.pdf')#"/>
<cftry>
<cfpdf action="archive" source="#sourcefile#" destination="#archivedfile#" standard="2b" overwrite="true"/>
<cfcatch name="myvar">
<cfdump var="#myvar#">
</cfcatch>
</cftry>
<!--- archive standard=3b --->
<cfset sourcefile="#ExpandPath('hello.pdf')#"/>
<cfset archivedfile="#ExpandPath('Hello_archived.pdf')#"/>
<cftry>
<cfpdf action="archive" source="#sourcefile#" destination="#archivedfile#" standard="3b" overwrite="true"/>
<cfcatch name="myvar">
<cfdump var="#myvar#">
</cfcatch>
</cftry><cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_pages_deleted.pdf')#">
<cfpdf action="deletepages"
pages="5-10"
source="#sourcefile#"
destination="#destfile#"
overwrite="yes"
><cfset sourcefile=ExpandPath("comment.pdf")/>
<cfset destinationfile=ExpandPath("comment_exported.fdf")/>
<cfpdf action="export"
type="comment"
source="#sourcefile#"
exportto="#destinationfile#"
overwrite="true"
><cfset sourcefile="#ExpandPath('metadata.pdf')#"/>
<cfset destinationfile="#ExpandPath('metadata_exported.xmp')#"/>
<cfpdf action="export"
type="metadata"
source="#sourcefile#"
exportto="#destinationfile#"
overwrite="true"
><cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfpdf action = "extractimage"
source = "#sourcefile#"
pages = "1-20"
destination = "images"
imageprefix = "cf_"
format="jpg"
overwrite="yes"
><cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfpdf action="extracttext"
source="#sourcefile#"
name="myXML"
pages="1-10"
overwrite="yes"
>
<cfcontent type="text/xml" />
<cfoutput>#myXML#</cfoutput><cfset sourcefile=ExpandPath("coldfusion.pdf")/>
<cfpdf action="getInfo" source="#sourcefile#" name="PDFInfo">
<cfdump var="#PDFInfo#" ><cfset sourcefile="#ExpandPath('noComment.pdf')#"/>
<cfset destinationfile="#ExpandPath('withComment.pdf')#"/>
<cfset importfromfilename = "#ExpandPath('comment_exported.xfdf')#">
<cfpdf action="import"
type="comment"
source="#sourcefile#"
importfrom="#importfromfilename#"
destination="#destinationfile#"
overwrite="true"
><cfset sourcefile="#ExpandPath('noMetadata.pdf')#"/>
<cfset destinationfile="#ExpandPath('metadataImported.pdf')#"/>
<cfset importfromfilename = "#ExpandPath('metadata_exported.xmp')#">
<cftry>
<cfpdf action="import" type="metadata" source="#sourcefile#"
importfrom="#importfromfilename#" destination="#destinationfile#" overwrite="true" >
<cfcatch name="mycatch">
<cfdump var="#mycatch#" >
</cfcatch>
</cftry><cfset source1="#ExpandPath('coldfusion.pdf')#"/>
<cfset source2="#ExpandPath('security.pdf')#"/>
<cfset source3="#ExpandPath('sessionsecurity.pdf')#"/>
<cfset desfile="#ExpandPath('merged.pdf')#"/>
<cfpdf action="merge"
source="#source1#,#source2#,#source3#"
destination="#desfile#"
overwrite="yes"
><cfset source1="#ExpandPath('coldfusion.pdf')#"/>
<cfset source2="#ExpandPath('security.pdf')#"/>
<cfset source3="#ExpandPath('sessionsecurity.pdf')#"/>
<cfset desfile="#ExpandPath('merged_new_PDF.pdf')#"/>
<cfpdf action="merge" destination="#desfile#" overwrite="yes">
<cfpdfparam source="#source1#" pages="1-5"/>
<cfpdfparam source="#source2#" pages=2 />
<cfpdfparam source="#source3#" pages="3-6" />
</cfpdf><cfset sourcefile="#ExpandPath('coldfusion.pdf')#"/>
<cfset desfile="#ExpandPath('optimized_nn.pdf')#"/>
<cfpdf action="optimize" source="#sourcefile#" destination="#desfile#" algo="Nearest_Neighbour" overwrite="yes"><cfset sourcefile="#ExpandPath('coldfusion.pdf')#"/>
<cfset desfile="#ExpandPath('optimized_biliear.pdf')#"/>
<cfpdf action="optimize" source="#sourcefile#" destination="#desfile#" algo="bilinear" overwrite="yes"><cfset sourcefile="#ExpandPath('coldfusion.pdf')#"/>
<cfset desfile="#ExpandPath('optimized_bicubic.pdf')#"/>
<cfpdf action="optimize" source="#sourcefile#" destination="#desfile#" algo="bicubic" overwrite="yes"><?xml version="1.0" encoding="UTF-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd">
<PDF result="Out1">
<PDF source="Doc1"/>
<PDF source="Doc2"/>
</PDF>
</DDX><cfset source1="#ExpandPath('security.pdf')#"/>
<cfset source2="#ExpandPath('sessionsecurity.pdf')#"/>
<cfset outfile="#ExpandPath('book.pdf')#"/>
<cfset ddxloc="#ExpandPath('merge.ddx')#"/>
<!--- This code creates a structure for the input files. --->
<cfset inputStruct=StructNew()>
<cfset inputStruct.Doc1="#source1#">
<cfset inputStruct.Doc2="#source2#">
<!--- This code creates a structure for the output file. --->
<cfset outputStruct=StructNew()>
<cfset outputStruct.Out1="#outfile#">
<!--- This code processes the DDX instructions and generates the book. --->
<cfpdf action="processddx" ddxfile="#ddxloc#" inputfiles="#inputStruct#" outputfiles="#outputStruct#" name="myBook">
<cfdump var="#myBook#"><cfset sourcefile="#ExpandPath('coldfusion.pdf')#"/>
<cfset desfile="#ExpandPath('coldfusion_protected.pdf')#"/>
<cfpdf action="protect"
source="#sourceFile#"
destination="#desfile#"
newUserPassword="password"
><cfset sourcefile="#ExpandPath('coldfusion.pdf')#"/>
<cfpdf action="read" name="myBook" source="#sourcefile#" >
<cfdump var="#myBook#" ><cfset sourcefile=ExpandPath('redact.pdf')/>
<cfset destinationfile=ExpandPath("redact_result.pdf")/>
<cfpdf action="redact" source="#sourcefile#" destination="#destinationfile#" overwrite="true">
<cfpdfparam pages="1,2" coordinates="306,426,366,496" >
<cfpdfparam pages="3" coordinates="100,100,400,400">
<cfpdfparam pages="*" coordinates="0,0,100,100">
</cfpdf><cfset sourcefile=ExpandPath('coldfusion_header_footer.pdf')/>
<cfset desfile=ExpandPath('coldfusion_no_header_footer.pdf')/>
<cfpdf action = "removeheaderfooter"
source="#sourcefile#"
destination = "#desfile#"
pages="1-5"
overwrite="yes"
><cfset sourcefile=ExpandPath('coldfusion_watermark.pdf')/>
<cfset desfile=ExpandPath('coldfusion_no_watermark.pdf')/>
<cfpdf action = "removewatermark"
source="#sourcefile#"
destination = "#desfile#"
pages="3-5"
overwrite="yes"
><cfset sourcefile="#ExpandPath('CF_Hotfix.pdf')#"/>
<cfset destinationfile="#ExpandPath('CF_Hotfix_Sanitized.pdf')#"/>
<cfpdf action="sanitize"
source="#sourcefile#"
destination="#destinationfile#"
overwrite="true"
><cfset PDFinfo=StructNew()>
<cfset PDFinfo.Title="Apply Hotfixes to ColdFusion">
<cfset PDFinfo.Author="ColdFusion Developer">
<cfset PDFinfo.Keywords="ColdFusion,Update, Hotfix, Security Update">
<cfset PDFinfo.Subject="ColdFusion Hotfixes">
<cfset sourcefile="file.pdf"/>
<cfset desfile="file_info.pdf"/>
<cfpdf action="setInfo"
source="#sourcefile#"
info="#PDFinfo#"
destination="#desfile#"
overwrite="yes"
> keytool - genkey -alias pdfdomain - keyalg RSA - keystore KeyStore.jks - keysize 2048 keytool - certreq -alias pdfdomain - keystore KeyStore.jks -file pdfdomain . csr <!---- Sign a specific pdf by creating a signature field and signing it with authoured signature --->
<cfset sourcefile=ExpandPath('coldfusion.pdf')/>
<cfset destinationfile=ExpandPath("cf_signed.pdf")/>
<cfset pathtokeystore=ExpandPath("KeyStore.jks")/>
<cfpdf action="sign"
source="#sourcefile#"
destination="#destinationfile#"
keystore="#pathtokeystore#"
keystorepassword="password"
overwrite="true"
pages="1"
height="100"
width="100"
position="100,100"
author="true"
><cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfpdf action="read" name="myDoc" source="#sourcefile#" />
<cfpdf action="thumbnail" source="myDoc" destination="C:\cfpdf\" overwrite="yes" />
<cfimage action="read" name="img" source="C:\cfpdf\thumbnail_page_1.jpg" format="jpg" /><cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfset desfile="#ExpandPath('coldfusion_transformed.pdf')#">
<cfpdf action = "transform"
source = "#sourcefile#"
destination = "#desfile#"
hscale = ".5"
vscale = ".8"
position = "8, 10"
rotation = "180"
overwrite="yes"
><cfset sourcefile=ExpandPath('cf_signed.pdf')/>
<cfset destinationfile=ExpandPath("cf_unsigned.pdf")/>
<cfpdf action="unsign"
source="#sourcefile#"
destination="#destinationfile#"
unsignall="true"
overwrite="true"
><cfset sourcefile="#ExpandPath('cf_signed.pdf')#">
<cfpdf action="validatesignature" source="#sourceFile#" name="pdfInfo">
<cfoutput>#pdfInfo.SUCCESS#</cfoutput> <!--- returns YES ---><!--- write the properties of the PDF --->
<cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfpdf action="write"
source="#sourcefile#"
name="PDFout"
overwrite="yes">
<cfdump var="#PDFout#" ><!--- Write the PDF document to another PDF --->
<cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfset desfile="#ExpandPath('coldfusion_write.pdf')#">
<cfpdf action="write"
source="#sourcefile#"
destination="#desfile#"
overwrite="yes"
><cfparam name="url.action" default="">
<cfif url.action EQ "merge">
<cftry>
<!--- Document 1: Service Agreement (Page 1) --->
<cfdocument format="pdf" name="doc1_agreement">
<html>
<head>
<style>
body { font-family: 'Times New Roman', serif; margin: 60px; line-height: 1.8; }
.header { text-align: center; border-bottom: 3px solid ##000; padding-bottom: 20px; margin-bottom: 30px; }
h1 { font-size: 24px; text-transform: uppercase; margin: 0; }
h2 { font-size: 18px; margin-top: 30px; border-bottom: 1px solid ##666; padding-bottom: 5px; }
.parties { background-color: ##f9f9f9; padding: 20px; margin: 20px 0; border-left: 4px solid ##333; }
</style>
</head>
<body>
<div class="header">
<h1>Professional Services Agreement</h1>
<p style="font-size: 14px; margin-top: 10px;">Contract No. PSA-2024-00147</p>
</div>
<div class="parties">
<p><strong>This Agreement</strong> is entered into as of January 15, 2024, between:</p>
<p><strong>CLIENT:</strong> Acme Corporation, a Delaware corporation<br>
123 Business Plaza, Suite 500, New York, NY 10001</p>
<p><strong>CONSULTANT:</strong> Professional Tech Solutions LLC<br>
456 Innovation Drive, San Francisco, CA 94105</p>
</div>
<h2>ARTICLE I: SCOPE OF SERVICES</h2>
<p>Consultant agrees to provide the following professional services to Client:</p>
<ol>
<li><strong>System Architecture Design:</strong> Design and document enterprise-level system architecture for Client's new customer management platform.</li>
<li><strong>Technical Implementation:</strong> Oversee the implementation phase including database design, API development, and integration with existing systems.</li>
<li><strong>Quality Assurance:</strong> Conduct comprehensive testing and quality assurance processes to ensure system reliability and performance.</li>
<li><strong>Documentation:</strong> Provide complete technical documentation, user manuals, and training materials.</li>
</ol>
<h2>ARTICLE II: COMPENSATION AND PAYMENT TERMS</h2>
<p><strong>2.1 Project Fee:</strong> The total project fee is <strong>$125,000 USD</strong>, payable as follows:</p>
<ul>
<li>30% ($37,500) upon contract execution</li>
<li>40% ($50,000) upon completion of design phase (estimated 60 days)</li>
<li>30% ($37,500) upon final delivery and acceptance</li>
</ul>
<p><strong>2.2 Payment Terms:</strong> All invoices are due within 30 days of receipt. Late payments will incur interest at 1.5% per month.</p>
<h2>ARTICLE III: TERM AND TERMINATION</h2>
<p><strong>3.1 Term:</strong> This Agreement shall commence on February 1, 2024, and continue for a period of six (6) months, with an estimated completion date of July 31, 2024.</p>
<p><strong>3.2 Termination:</strong> Either party may terminate this Agreement with 30 days' written notice. Upon termination, Client shall pay for all services rendered through the termination date.</p>
<cfdocumentitem type="footer">
<div style="text-align: center; font-size: 10px; color: ##666; margin-top: 40px; padding-top: 10px; border-top: 1px solid ##ddd;">
Service Agreement - Document 1 - Page #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#
</div>
</cfdocumentitem>
</body>
</html>
</cfdocument>
<!--- Document 2: Statement of Work (Page 2) --->
<cfdocument format="pdf" name="doc2_sow">
<html>
<head>
<style>
body { font-family: 'Times New Roman', serif; margin: 60px; line-height: 1.8; }
.header { text-align: center; border-bottom: 3px solid ##000; padding-bottom: 20px; margin-bottom: 30px; }
h1 { font-size: 24px; text-transform: uppercase; margin: 0; }
h2 { font-size: 18px; margin-top: 30px; border-bottom: 1px solid ##666; padding-bottom: 5px; }
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
th, td { border: 1px solid ##333; padding: 12px; text-align: left; }
th { background-color: ##333; color: white; font-weight: bold; }
</style>
</head>
<body>
<div class="header">
<h1>Statement of Work (SOW)</h1>
<p style="font-size: 14px; margin-top: 10px;">Exhibit A to Professional Services Agreement</p>
</div>
<h2>PROJECT DELIVERABLES AND TIMELINE</h2>
<table>
<tr>
<th>Phase</th>
<th>Deliverable</th>
<th>Timeline</th>
<th>Payment</th>
</tr>
<tr>
<td><strong>Phase 1</strong><br>Discovery</td>
<td>Requirements Document<br>Architecture Design<br>Technical Specifications</td>
<td>Weeks 1-4<br>(Feb 1-28)</td>
<td>$37,500<br>(30%)</td>
</tr>
<tr>
<td><strong>Phase 2</strong><br>Development</td>
<td>Database Schema<br>API Implementation<br>Integration Layer</td>
<td>Weeks 5-16<br>(Mar 1-May 15)</td>
<td>$50,000<br>(40%)</td>
</tr>
<tr>
<td><strong>Phase 3</strong><br>Testing & Delivery</td>
<td>QA Testing Report<br>Documentation<br>Training Materials<br>Final Deployment</td>
<td>Weeks 17-24<br>(May 16-Jul 31)</td>
<td>$37,500<br>(30%)</td>
</tr>
</table>
<h2>ACCEPTANCE CRITERIA</h2>
<p>Each deliverable must meet the following criteria for acceptance:</p>
<ul>
<li>All specified functionality is implemented and operational</li>
<li>System passes all defined test cases with 95% success rate</li>
<li>Documentation is complete, accurate, and professionally formatted</li>
<li>Client has 14 business days to review and provide written acceptance</li>
</ul>
<h2>RESOURCES AND RESPONSIBILITIES</h2>
<p><strong>Consultant will provide:</strong></p>
<ul>
<li>Senior System Architect (lead consultant)</li>
<li>Two Backend Developers</li>
<li>Quality Assurance Specialist</li>
<li>Technical Writer</li>
</ul>
<p><strong>Client will provide:</strong></p>
<ul>
<li>Access to existing systems and databases</li>
<li>Dedicated project manager for coordination</li>
<li>Timely feedback and approvals</li>
<li>Development and testing environments</li>
</ul>
<cfdocumentitem type="footer">
<div style="text-align: center; font-size: 10px; color: ##666; margin-top: 40px; padding-top: 10px; border-top: 1px solid ##ddd;">
Statement of Work - Document 2 - Page #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#
</div>
</cfdocumentitem>
</body>
</html>
</cfdocument>
<!--- Document 3: Signature Page (Page 3) --->
<cfdocument format="pdf" name="doc3_signatures">
<html>
<head>
<style>
body { font-family: 'Times New Roman', serif; margin: 60px; line-height: 1.8; }
.header { text-align: center; border-bottom: 3px solid ##000; padding-bottom: 20px; margin-bottom: 30px; }
h1 { font-size: 24px; text-transform: uppercase; margin: 0; }
.signature-block { margin-top: 60px; page-break-inside: avoid; }
.signature-line { border-bottom: 2px solid ##000; width: 350px; margin: 10px 0; }
.execution { background-color: ##f9f9f9; padding: 20px; margin: 30px 0; border: 2px solid ##333; }
</style>
</head>
<body>
<div class="header">
<h1>Execution of Agreement</h1>
<p style="font-size: 14px; margin-top: 10px;">Signature Page</p>
</div>
<div class="execution">
<p><strong>IN WITNESS WHEREOF</strong>, the parties hereto have executed this Professional Services Agreement as of the date first written above.</p>
</div>
<div class="signature-block">
<p><strong>CLIENT: Acme Corporation</strong></p>
<div class="signature-line"></div>
<p>Signature</p>
<p><strong>Name:</strong> Michael Chen<br>
<strong>Title:</strong> Chief Technology Officer<br>
<strong>Date:</strong> <cfoutput>#dateFormat(now(), "mmmm d, yyyy")#</cfoutput></p>
</div>
<div class="signature-block">
<p><strong>CONSULTANT: Professional Tech Solutions LLC</strong></p>
<div class="signature-line"></div>
<p>Signature</p>
<p><strong>Name:</strong> Sarah Rodriguez<br>
<strong>Title:</strong> Managing Partner<br>
<strong>Date:</strong> <cfoutput>#dateFormat(now(), "mmmm d, yyyy")#</cfoutput></p>
</div>
<div style="margin-top: 80px; padding: 20px; background-color: ##f0f0f0; border-left: 4px solid ##333;">
<p style="font-size: 12px; margin: 0;"><strong>NOTARY:</strong> This document has been executed and delivered by the parties as a sealed instrument on the date indicated above.</p>
</div>
<cfdocumentitem type="footer">
<div style="text-align: center; font-size: 10px; color: ##666; margin-top: 40px; padding-top: 10px; border-top: 1px solid ##ddd;">
Signature Page - Document 3 - Page #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#
</div>
</cfdocumentitem>
</body>
</html>
</cfdocument>
<!--- MERGE ALL DOCUMENTS USING CFPDF --->
<cfpdf action="merge" name="completePackage">
<cfpdfparam source="#doc1_agreement#">
<cfpdfparam source="#doc2_sow#">
<cfpdfparam source="#doc3_signatures#">
</cfpdf>
<!--- Output merged PDF to browser --->
<cfheader name="Content-Disposition" value="inline; filename=Complete_Service_Agreement_Package.pdf">
<cfcontent type="application/pdf" variable="#completePackage#" reset="true">
<cfcatch>
<h2 style="color: red;">Error Creating PDF</h2>
<cfoutput>
<p><strong>Error:</strong> #cfcatch.message#</p>
<p><strong>Detail:</strong> #cfcatch.detail#</p>
</cfoutput>
</cfcatch>
</cftry>
<cfelse>
<!--- Landing Page --->
<h1>Use Case 1: Merging Multiple PDFs</h1>
<div style="background-color: ##fff3e0; border-left: 6px solid ##ff9800; padding: 25px; margin: 25px 0;">
<h2 style="margin-top: 0; color: ##e65100;">⚖️ Business Scenario: Law Firm Case Assembly</h2>
<p style="font-size: 16px; line-height: 1.8;"><strong>Challenge:</strong> A law firm needs to assemble complete case packages for court filing. Each case requires combining the service agreement, statement of work, and signature pages into a single PDF document.</p>
<p style="font-size: 16px; line-height: 1.8;"><strong>Solution:</strong> Use <code>cfpdf action="merge"</code> to automatically combine all documents into one professional package.</p>
<p style="font-size: 16px; line-height: 1.8;"><strong>Benefits:</strong> Eliminates manual PDF assembly, ensures correct document order, reduces filing errors, and saves time.</p>
</div>
<div style="background-color: ##e3f2fd; border: 2px solid ##1976d2; padding: 25px; margin: 25px 0;">
<h3 style="margin-top: 0;">📄 This Demo Will Merge:</h3>
<ol style="font-size: 16px; line-height: 2;">
<li><strong>Document 1:</strong> Professional Services Agreement (detailed contract terms)</li>
<li><strong>Document 2:</strong> Statement of Work (project deliverables and timeline)</li>
<li><strong>Document 3:</strong> Signature Page (execution and notarization)</li>
</ol>
<p style="font-size: 16px;"><strong>Result:</strong> One complete, professionally formatted PDF ready for filing.</p>
</div>
<div style="text-align: center; margin: 50px 0;">
<a href="?action=merge"
style="display: inline-block; padding: 25px 60px; background: linear-gradient(135deg, ##1976d2 0%, ##1565c0 100%);
color: white; text-decoration: none; font-size: 22px; font-weight: bold; border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2); transition: all 0.3s;">
📑 Merge Documents & View PDF
</a>
<p style="margin-top: 15px; color: ##666;">Click to generate and view the complete merged PDF package</p>
</div>
<hr style="margin: 40px 0;">
</cfif><cfparam name="url.status" default="">
<cfif len(url.status) GT 0>
<cftry>
<!--- Create realistic manuscript document --->
<cfdocument format="pdf" name="manuscript">
<html>
<head>
<style>
body { font-family: 'Georgia', serif; margin: 70px; line-height: 1.8; font-size: 12pt; }
.title-page { text-align: center; margin-top: 150px; }
.title-page h1 { font-size: 32pt; margin-bottom: 20px; }
.title-page .author { font-size: 18pt; margin-top: 40px; }
.chapter { page-break-before: always; }
.chapter h2 { font-size: 20pt; margin-bottom: 30px; text-align: center; }
p { text-align: justify; text-indent: 40px; }
p.first { text-indent: 0; }
</style>
</head>
<body>
<div class="title-page">
<h1>The Digital Transformation Journey</h1>
<p class="author">by Dr. Jennifer Martinez</p>
<p style="margin-top: 60px; font-size: 14pt;">A Comprehensive Guide to Enterprise Innovation</p>
<p style="margin-top: 150px; font-size: 11pt;">
<cfoutput>
<cfif url.status EQ "draft">
DRAFT VERSION - #dateFormat(now(), "mmmm d, yyyy")#
<cfelseif url.status EQ "review">
REVIEW COPY - #dateFormat(now(), "mmmm d, yyyy")#
<cfelseif url.status EQ "final">
APPROVED FOR PUBLICATION - #dateFormat(now(), "mmmm d, yyyy")#
<cfelse>
CONFIDENTIAL MANUSCRIPT - #dateFormat(now(), "mmmm d, yyyy")#
</cfif>
</cfoutput>
</p>
</div>
<div class="chapter">
<h2>Chapter 1: Understanding Digital Transformation</h2>
<p class="first">In today's rapidly evolving business landscape, digital transformation has emerged as a critical imperative for organizations seeking to remain competitive and relevant. The concept extends far beyond mere technological adoption; it represents a fundamental reimagining of how businesses operate, deliver value, and engage with customers in an increasingly digital world.</p>
<p>Digital transformation is not simply about implementing new technology solutions. Rather, it encompasses a holistic shift in organizational culture, processes, and mindset. Companies that successfully navigate this journey recognize that technology serves as an enabler, not an end in itself. The true power of digital transformation lies in its ability to reshape business models, create new revenue streams, and deliver enhanced customer experiences.</p>
<p>Consider the case of traditional retail organizations. Those that embraced digital transformation early integrated e-commerce platforms, mobile applications, and data analytics into their core operations. They didn't merely add online sales channels; they fundamentally reconsidered how customers discover, evaluate, and purchase products. This comprehensive approach enabled them to compete effectively against digital-native competitors while leveraging their existing brand equity and physical presence.</p>
<p>The journey begins with leadership commitment. Executives must champion the transformation initiative, allocating resources and setting clear strategic objectives. This top-down support proves essential for overcoming organizational resistance and ensuring sustained momentum throughout the transformation process.</p>
<p>However, successful transformation also requires bottom-up engagement. Employees at all levels must understand the vision, embrace new ways of working, and contribute innovative ideas. Organizations that foster a culture of experimentation and learning position themselves to capitalize on emerging opportunities and adapt quickly to market changes.</p>
</div>
<div class="chapter">
<h2>Chapter 2: Building the Foundation</h2>
<p class="first">Establishing a solid foundation for digital transformation requires careful attention to several critical elements. First and foremost, organizations must invest in robust technology infrastructure capable of supporting current and future needs. Cloud computing platforms provide the scalability and flexibility essential for modern digital operations.</p>
<p>Data management capabilities represent another crucial foundation element. Companies generate vast amounts of data daily, but raw data holds little value without proper collection, storage, and analysis mechanisms. Implementing comprehensive data governance frameworks ensures information quality, security, and compliance while enabling data-driven decision-making across the organization.</p>
<p>Cybersecurity considerations must be integrated into every aspect of digital transformation initiatives. As organizations expand their digital footprint, they simultaneously increase their exposure to potential cyber threats. A proactive security posture, incorporating both technical controls and employee awareness training, protects valuable digital assets and maintains customer trust.</p>
<p>Perhaps most importantly, organizations must cultivate digital talent. This involves both recruiting individuals with specialized digital skills and upskilling existing employees. Training programs, mentorship opportunities, and continuous learning initiatives help build internal capabilities necessary for sustaining transformation efforts over time.</p>
</div>
<cfdocumentitem type="footer">
<div style="text-align: center; font-size: 10pt; color: ##666; margin-top: 40px;">
Page #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#
</div>
</cfdocumentitem>
</body>
</html>
</cfdocument>
<!--- Apply appropriate watermark based on status using cfpdf --->
<cfif url.status EQ "draft">
<cfpdf action="addWatermark"
source="#manuscript#"
name="watermarkedDoc"
text="DRAFT"
opacity="0.3"
rotation="45">
<cfelseif url.status EQ "review">
<cfpdf action="addWatermark"
source="#manuscript#"
name="watermarkedDoc"
text="FOR REVIEW ONLY"
opacity="0.25"
rotation="0"
position="0,50">
<cfelseif url.status EQ "final">
<cfpdf action="addWatermark"
source="#manuscript#"
name="watermarkedDoc"
text="APPROVED"
opacity="0.2"
rotation="0">
<cfelse>
<cfpdf action="addWatermark"
source="#manuscript#"
name="watermarkedDoc"
text="CONFIDENTIAL - DO NOT DISTRIBUTE"
opacity="0.4"
rotation="45">
</cfif>
<!--- Output watermarked PDF --->
<cfheader name="Content-Disposition" value="inline; filename=Manuscript_#uCase(url.status)#.pdf">
<cfcontent type="application/pdf" variable="#watermarkedDoc#" reset="true">
<cfcatch>
<h2 style="color: red;">Error Creating PDF</h2>
<cfoutput>
<p><strong>Error:</strong> #cfcatch.message#</p>
</cfoutput>
</cfcatch>
</cftry>
<cfelse>
<!--- Landing Page --->
<h1>Use Case 2: Adding Status Watermarks</h1>
<div style="background-color: ##e8f5e9; border-left: 6px solid ##4caf50; padding: 25px; margin: 25px 0;">
<h2 style="margin-top: 0; color: ##2e7d32;">📚 Business Scenario: Publishing Company Workflow</h2>
<p style="font-size: 16px; line-height: 1.8;"><strong>Challenge:</strong> A publishing company receives manuscripts in various stages of production. Editors, reviewers, and designers need to instantly identify whether a document is a draft, under review, confidential, or approved for publication.</p>
<p style="font-size: 16px; line-height: 1.8;"><strong>Solution:</strong> Use <code>cfpdf action="addWatermark"</code> to automatically mark each document with its current status.</p>
<p style="font-size: 16px; line-height: 1.8;"><strong>Benefits:</strong> Prevents publication of draft versions, clearly identifies review copies, protects confidential content, and streamlines editorial workflow.</p>
</div>
<div style="background-color: ##fff3e0; border: 2px solid ##ff9800; padding: 25px; margin: 25px 0;">
<h3 style="margin-top: 0;">📝 Sample Manuscript: "The Digital Transformation Journey"</h3>
<p style="font-size: 16px;">A professional business book manuscript with multiple chapters. Select the document status to see how watermarks identify different workflow stages.</p>
</div>
<h2 style="text-align: center; margin: 40px 0;">Select Document Status:</h2>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; margin: 40px 0;">
<a href="?status=draft" style="text-decoration: none;">
<div style="border: 3px solid ##f44336; padding: 30px; background: linear-gradient(135deg, ##fff 0%, ##ffebee 100%);
text-align: center; border-radius: 10px; transition: transform 0.2s;">
<div style="font-size: 48px; margin-bottom: 15px;">✏️</div>
<h3 style="color: ##f44336; margin: 10px 0;">DRAFT</h3>
<p style="color: ##666; margin: 10px 0;">Diagonal watermark<br>30% opacity<br>Initial version</p>
</div>
</a>
<a href="?status=review" style="text-decoration: none;">
<div style="border: 3px solid ##2196f3; padding: 30px; background: linear-gradient(135deg, ##fff 0%, ##e3f2fd 100%);
text-align: center; border-radius: 10px; transition: transform 0.2s;">
<div style="font-size: 48px; margin-bottom: 15px;">👁️</div>
<h3 style="color: ##2196f3; margin: 10px 0;">FOR REVIEW</h3>
<p style="color: ##666; margin: 10px 0;">Top watermark<br>25% opacity<br>Editor review copy</p>
</div>
</a>
<a href="?status=final" style="text-decoration: none;">
<div style="border: 3px solid ##4caf50; padding: 30px; background: linear-gradient(135deg, ##fff 0%, ##e8f5e9 100%);
text-align: center; border-radius: 10px; transition: transform 0.2s;">
<div style="font-size: 48px; margin-bottom: 15px;">✓</div>
<h3 style="color: ##4caf50; margin: 10px 0;">APPROVED</h3>
<p style="color: ##666; margin: 10px 0;">Center watermark<br>20% opacity<br>Ready for publication</p>
</div>
</a>
<a href="?status=confidential" style="text-decoration: none;">
<div style="border: 3px solid ##d32f2f; padding: 30px; background: linear-gradient(135deg, ##fff 0%, ##ffcdd2 100%);
text-align: center; border-radius: 10px; transition: transform 0.2s;">
<div style="font-size: 48px; margin-bottom: 15px;">🔒</div>
<h3 style="color: ##d32f2f; margin: 10px 0;">CONFIDENTIAL</h3>
<p style="color: ##666; margin: 10px 0;">Diagonal watermark<br>40% opacity<br>Do not distribute</p>
</div>
</a>
</div>
</cfif><cfparam name="url.action" default="">
<cfif url.action EQ "generate">
<cftry>
<!--- Generate unique employee ID and password --->
<cfset employeeID = "EMP" & randRange(10000, 99999)>
<cfset accessPassword = "HR" & year(now()) & randRange(1000, 9999)>
<!--- Create confidential compensation document --->
<cfdocument format="pdf" name="compensationDoc">
<html>
<head>
<style>
body { font-family: Arial, sans-serif; margin: 60px; line-height: 1.6; }
.header { background-color: ##1565c0; color: white; padding: 25px; margin: -60px -60px 30px -60px; }
.header h1 { margin: 0; font-size: 26px; }
.confidential { background-color: ##ffebee; border: 3px solid ##c62828; padding: 20px; margin: 20px 0; text-align: center; }
.confidential p { color: ##c62828; font-weight: bold; font-size: 18px; margin: 0; }
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
th, td { border: 1px solid ##ddd; padding: 12px; text-align: left; }
th { background-color: ##e3f2fd; font-weight: bold; color: ##1565c0; }
.total-row { background-color: ##fff3e0; font-weight: bold; font-size: 16px; }
.section { margin: 30px 0; }
h2 { color: ##1565c0; border-bottom: 2px solid ##1565c0; padding-bottom: 8px; }
</style>
</head>
<body>
<div class="header">
<h1>Annual Compensation Statement</h1>
<p style="margin: 10px 0 0 0; font-size: 14px;">Fiscal Year 2024 - CONFIDENTIAL</p>
</div>
<div class="confidential">
<p>🔒 CONFIDENTIAL EMPLOYEE INFORMATION</p>
<p style="font-size: 14px; margin-top: 10px;">This document contains sensitive salary and benefit details</p>
</div>
<div class="section">
<h2>Employee Information</h2>
<table style="width: 70%;">
<tr>
<th style="width: 40%;">Employee ID:</th>
<td><cfoutput>#employeeID#</cfoutput></td>
</tr>
<tr>
<th>Full Name:</th>
<td>Jennifer Martinez</td>
</tr>
<tr>
<th>Position:</th>
<td>Senior Software Engineer</td>
</tr>
<tr>
<th>Department:</th>
<td>Engineering - Cloud Platform</td>
</tr>
<tr>
<th>Employment Date:</th>
<td>March 15, 2019</td>
</tr>
<tr>
<th>Report Date:</th>
<td><cfoutput>#dateFormat(now(), "mmmm d, yyyy")#</cfoutput></td>
</tr>
</table>
</div>
<div class="section">
<h2>Compensation Breakdown</h2>
<table>
<tr>
<th>Component</th>
<th style="text-align: right;">Annual Amount</th>
<th style="text-align: right;">Monthly Amount</th>
</tr>
<tr>
<td>Base Salary</td>
<td style="text-align: right;">$145,000.00</td>
<td style="text-align: right;">$12,083.33</td>
</tr>
<tr>
<td>Performance Bonus (Target 15%)</td>
<td style="text-align: right;">$21,750.00</td>
<td style="text-align: right;">$1,812.50</td>
</tr>
<tr>
<td>Stock Options (Annual Vest)</td>
<td style="text-align: right;">$18,000.00</td>
<td style="text-align: right;">$1,500.00</td>
</tr>
<tr>
<td>401(k) Employer Match (6%)</td>
<td style="text-align: right;">$8,700.00</td>
<td style="text-align: right;">$725.00</td>
</tr>
<tr class="total-row">
<td>Total Cash Compensation</td>
<td style="text-align: right;">$193,450.00</td>
<td style="text-align: right;">$16,120.83</td>
</tr>
</table>
</div>
<div class="section">
<h2>Benefits Package</h2>
<table>
<tr>
<th>Benefit</th>
<th style="text-align: right;">Employer Contribution</th>
</tr>
<tr>
<td>Health Insurance (Medical, Dental, Vision)</td>
<td style="text-align: right;">$12,500.00</td>
</tr>
<tr>
<td>Life Insurance & Disability</td>
<td style="text-align: right;">$1,200.00</td>
</tr>
<tr>
<td>Professional Development Allowance</td>
<td style="text-align: right;">$3,000.00</td>
</tr>
<tr>
<td>Wellness Program & Gym Membership</td>
<td style="text-align: right;">$800.00</td>
</tr>
<tr>
<td>Commuter Benefits</td>
<td style="text-align: right;">$1,500.00</td>
</tr>
<tr class="total-row">
<td>Total Benefits Value</td>
<td style="text-align: right;">$19,000.00</td>
</tr>
</table>
</div>
<div class="section">
<h2>Total Compensation Package</h2>
<table style="width: 60%;">
<tr class="total-row" style="font-size: 18px;">
<td style="background-color: ##1565c0; color: white;">TOTAL ANNUAL COMPENSATION</td>
<td style="background-color: ##1565c0; color: white; text-align: right;">$212,450.00</td>
</tr>
</table>
</div>
<div style="margin-top: 60px; padding: 20px; background-color: ##ffebee; border-left: 6px solid ##c62828;">
<p style="margin: 0; font-size: 12px; line-height: 1.8;"><strong>CONFIDENTIALITY NOTICE:</strong> This document contains confidential salary and benefit information. Distribution, copying, or disclosure to unauthorized parties is strictly prohibited. This information is provided for your personal records only.</p>
</div>
<cfdocumentitem type="footer">
<div style="text-align: center; font-size: 10px; color: ##666; margin-top: 30px;">
Confidential Compensation Statement - Page #cfdocument.currentpagenumber# - Employee ID: <cfoutput>#employeeID#</cfoutput>
</div>
</cfdocumentitem>
</body>
</html>
</cfdocument>
<!--- APPLY PASSWORD PROTECTION using cfpdf --->
<cfpdf action="protect"
source="#compensationDoc#"
name="protectedDoc"
newUserPassword="#accessPassword#"
encrypt="AES_128">
<!--- Show password information page --->
<h1>🔒 Document Successfully Protected!</h1>
<div style="background-color: ##ffebee; border: 4px solid ##c62828; padding: 35px; margin: 30px 0; border-radius: 10px;">
<h2 style="color: ##c62828; margin-top: 0; font-size: 24px;">⚠️ SAVE THIS PASSWORD</h2>
<p style="font-size: 18px; line-height: 1.8;">The compensation document has been encrypted with AES-128 security. You will need this password to open the PDF:</p>
<div style="background-color: ##fff; border: 4px dashed ##c62828; padding: 40px; margin: 30px 0; text-align: center;">
<p style="margin: 0 0 15px 0; font-size: 16px; color: ##666;">Password:</p>
<p style="margin: 0; font-family: 'Courier New', monospace; font-size: 42px; color: ##c62828; font-weight: bold; letter-spacing: 3px;">
<cfoutput>#accessPassword#</cfoutput>
</p>
</div>
<div style="background-color: ##fff3e0; padding: 20px; border-radius: 5px; margin: 20px 0;">
<h3 style="margin-top: 0; color: ##e65100;">📋 Document Details:</h3>
<ul style="font-size: 16px; line-height: 2;">
<cfoutput>
<li><strong>Employee ID:</strong> #employeeID#</li>
<li><strong>Document:</strong> Annual Compensation Statement 2024</li>
<li><strong>Protection:</strong> 128-bit AES Encryption</li>
<li><strong>Password Type:</strong> User password (required to open)</li>
<li><strong>Created:</strong> #dateTimeFormat(now(), "yyyy-mm-dd HH:nn:ss")#</li>
</cfoutput>
</ul>
</div>
</div>
<div style="text-align: center; margin: 40px 0;">
<!--- Use POST to hide password from URL --->
<form method="post" action="?action=download">
<cfoutput>
<input type="hidden" name="pdfData" value="#toBase64(protectedDoc)#">
<input type="hidden" name="empID" value="#employeeID#">
</cfoutput>
<button type="submit" style="padding: 20px 50px; background: linear-gradient(135deg, ##c62828 0%, ##b71c1c 100%);
color: white; border: none; font-size: 20px; font-weight: bold; border-radius: 8px;
cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.2);">
📥 Download Protected PDF
</button>
</form>
<p style="margin-top: 15px; color: ##666;">Write down the password before downloading</p>
</div>
<cfcatch>
<h2 style="color: red;">Error Creating Protected PDF</h2>
<cfoutput>
<p><strong>Error:</strong> #cfcatch.message#</p>
</cfoutput>
</cfcatch>
</cftry>
<cfelseif url.action EQ "download" AND isDefined("form.pdfData")>
<!--- Output the protected PDF for download --->
<cfset protectedPDF = toBinary(form.pdfData)>
<cfheader name="Content-Disposition" value="attachment; filename=Compensation_Statement_#form.empID#_PROTECTED.pdf">
<cfcontent type="application/pdf" variable="#protectedPDF#" reset="true">
<cfelse>
<!--- Landing Page --->
<h1>Use Case 3: Password Protecting PDFs</h1>
<div style="background-color: ##e1f5fe; border-left: 6px solid ##01579b; padding: 25px; margin: 25px 0;">
<h2 style="margin-top: 0; color: ##01579b;">👥 Business Scenario: HR Document Security</h2>
<p style="font-size: 16px; line-height: 1.8;"><strong>Challenge:</strong> The HR department must distribute annual compensation statements to 500+ employees. Each document contains confidential salary, bonus, and benefits information that must be protected from unauthorized access.</p>
<p style="font-size: 16px; line-height: 1.8;"><strong>Solution:</strong> Use <code>cfpdf action="protect"</code> to encrypt each PDF with a unique password, ensuring only the intended employee can view their compensation details.</p>
<p style="font-size: 16px; line-height: 1.8;"><strong>Benefits:</strong> Maintains confidentiality, complies with data protection regulations, prevents unauthorized disclosure, and provides secure document distribution.</p>
</div>
<div style="background-color: ##fff3e0; border: 2px solid ##ff6f00; padding: 25px; margin: 25px 0;">
<h3 style="margin-top: 0;">📊 Sample Document: Annual Compensation Statement</h3>
<p style="font-size: 16px; line-height: 1.8;">A comprehensive breakdown of employee compensation including base salary, bonuses, stock options, 401(k) matching, and full benefits package valuation. This sensitive document will be protected with 128-bit AES encryption.</p>
<div style="background-color: ##ffe0b2; padding: 15px; margin: 20px 0; border-radius: 5px;">
<p style="margin: 0; font-size: 14px;"><strong>🔐 Security Features:</strong></p>
<ul style="margin: 10px 0;">
<li>AES-128 encryption standard</li>
<li>Unique password per employee</li>
<li>Password required to open document</li>
<li>Prevents copying and printing without password</li>
</ul>
</div>
</div>
<div style="text-align: center; margin: 50px 0;">
<a href="?action=generate"
style="display: inline-block; padding: 25px 60px; background: linear-gradient(135deg, ##c62828 0%, ##b71c1c 100%);
color: white; text-decoration: none; font-size: 22px; font-weight: bold; border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);">
🔒 Generate Password-Protected PDF
</a>
<p style="margin-top: 15px; color: ##666;">Click to create and secure the compensation document</p>
</div>
<hr style="margin: 40px 0;">
</cfif>