Adobe COLDFUSION 9 Manual page 948

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
Using the Duplicate function to create versions of a PDF document
You can use the
Duplicate
PDF document from a single source file. For example, you can customize PDF output based on your audience by
creating clones of a PDF variable and performing different actions on each clone. The following example shows how
to create a clone of a PDF document in memory, and create one version of the document with a watermark and another
version of the document where permissions are restricted:
<cfset filename="coldfusion.pdf">
<!--- This code reads a PDF document into a PDF variable called pdfVar1.
--->
<cfpdf action="read" source="#filename#" name="pdfVar1">
<!--- This code uses the Duplicate function to create a clone of pdfVar1 called pdfVar2. --->
<cfset pdfVar2=Duplicate(pdfVar1)>
<!--- This code creates a watermarked version of the source PDF document from the pdfVar1
variable. --->
<cfpdf action="addwatermark" source="pdfVar1" rotation="45" image="watermark.jpg"
destination="watermark_coldfusion.pdf" overwrite="yes">
<!--- This code creates a protected version of the source PDF document from the pdfVar2
variable. --->
<cfpdf action=protect source="pdfVar2" encrypt="RC4_128" permissions="none"
newownerpassword="owner1" destination="restricted_coldfusion.pdf" overwrite="yes">
Using DDX to perform advanced tasks
LiveCycle Assembler is a server-based application that processes DDX, a declarative markup language used to define
PDF output files.
The
action lets you process DDX instructions without installing LiveCycle Assembler. In addition to all
processddx
of the functionality available with the other
such as adding a generated table of contents to a PDF document, adding headers and footers with automatic page
numbers, and creating groups of PDF documents to which you can apply formatting instructions.
ColdFusion does not provide complete LiveCycle Assembler functionality. For a list of DDX elements that you can
access from ColdFusion, see Supported DDX elements in the CFML Reference.
For complete DDX syntax, see the Adobe LiveCycle Assembler Document Description XML Reference.
Using DDX instructions with ColdFusion
Although you can type DDX instructions directly in ColdFusion, typically you use an external DDX file. A DDX file
is basically an XML file with a DDX extension (for example, merge.ddx). You can use any text editor to create a DDX
file. The DDX syntax requires that you enclose the instructions within DDX start and end tags. In the following
example, the
element provides instructions for merging two PDF source files (Doc1 and Doc2) into a result file
PDF
(Out1):
<?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>
In ColdFusion, you verify the source DDX file with the
function to clone PDF variables, which is an efficient way to create different versions of a
actions, you can use DDX instructions to perform advanced tasks,
cfpdf
IsDDX
Last updated 8/5/2010
function:
943

Advertisement

Table of Contents
loading

Table of Contents