Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 925

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
Extracting data from a PDF form submission
Data extraction differs based on how the PDF form is submitted. ColdFusion supports two types of PDF form
submission: HTTP post, which submits the form data, but not the form itself, and PDF, which submits the entire PDF file.
One use for PDF submission is for archival purpose: because the form is submitted with the data, you can write the
output to a file. HTTP post submissions process faster because only the field data is transmitted, which is useful for
updating a database or manipulating specific data collected from the form, but you cannot write an HTTP post
submission directly to a file.
Note: Although forms created in LiveCycle Designer allow several types of submission, including XDP and XML,
ColdFusion can extract data from HTTP post and PDF submissions only.
In LiveCycle Designer, the XML code for an HTTP post submission looks like the following example:
<submit format="formdata" target="http://localhost:8500/pdfforms/pdfreceiver.cfm"
textEncoding="UTF-8"/>
In LiveCycle Designer, the XML code for a PDF submission looks like the following example:
<submit format="pdf" target="http://localhost:8500/pdfforms/pdfreceiver.cfm"
textEncoding="UTF-16" xdpContent="pdf datasets xfdf"/>
Note: Acrobat forms are submitted in binary format, not XML format.
Extracting data from a PDF submission
Use the following code to extract data from a PDF submission and write it to a structure called fields:
<!--- The following code reads the submitted PDF file and generates a result structure called
fields. --->
<cfpdfform source="#PDF.content#" action="read" result="fields"/>
Use the
tag to display the data structure, as follows:
cfdump
<cfdump var="#fields#">
Note: When you extract data from a PDF submission, always specify
You can set the form fields to a variable, as the following example shows:
<cfset empForm="#fields.form1#">
Use the populate action of the
the following example, the unique filename is generated from a field on the PDF form:
<cfpdfform action="populate" source="#PDF.content#"
destination="timesheets\#empForm.txtsheet#.pdf" overwrite="yes"/>
Writing LiveCycle form output to an XDP file
For Acrobat forms, you can write the output to a PDF file only. For LiveCycle forms, you have the option to write the
output to an XDP file. The filename extension determines the file format: to save the output in XDP format, simply
use an XDP extension in the destination filename, as the following example shows:
<cfpdfform action="populate" source="#PDF.content#"
destination="timesheets\#empForm.txtsheet#.xdp" overwrite="yes"/>
An XDP file is an XML representation of a PDF file. In LiveCycle Designer, an XDP file contains the structure, data,
annotations, and other relevant data to LiveCycle forms, which renders the form at run time.
tag to write the output to a file. Specify
cfpdfform
Last updated 1/20/2012
as the source.
"#PDF.content#"
"#PDF.content#"
920
as the source. In

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents