Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 958

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
<h3>Downloading Federal Tax Documents</h3>
<p>Please choose the type of your business.</p>
<!--- Create the ColdFusion form to determine which PDF documents to merge. --->
<table>
<cfform action="cfpdfMergeActionTest.cfm" method="post">
<tr><td><cfinput type="radio" name="businessType"
Value="Sole Proprieter">Sole Proprietor</td></tr>
<tr><td><cfinput type="radio" name="businessType"
Value="Partnership">Partnership</td></tr>
<tr><td><cfinput type="radio" name="businessType" Value="S Corporation">
S Corporation</td></tr>
<cfinput type = "hidden" name = "selection required" value = "must make a selection">
<tr><td><cfinput type="Submit" name="OK" label="OK"></td></tr>
</tr>
</cfform>
</table>
The action page loops through the files in the taxes subdirectory and uses the
for each file. If the PDF file contains the business type keyword (Sole Proprietor, Partnership, or S Corporation),
ColdFusion adds the absolute path of the file to a comma-separated list. The
into an output PDF file:
<!--- Create a variable for the business type selected from the form. --->
<cfset bizType=#form.businessType#>
<!--- Create a variable for the path of the current directory. --->
<cfset thisPath=ExpandPath(".")>
<!--- List the files in the taxes subdirectory. --->
<cfdirectory action="list" directory="#thisPath#\taxes" name="filelist">
<!--- The following code loops through the files in the taxes subdirectory. The getInfo
action to retrieves the keywords for each file and determines whether the business type
matches one of the keywords in the file. If the file contains the business type keyword,
ColdFusion adds the file to a comma-separated list. --->
<cfset tempPath="">
<cfloop query="filelist">
<cfset fPath="#thisPath#\taxes\#filelist.name#">
<cfpdf action="GetInfo" source="#fPath#" name="kInfo"></cfpdf>
<cfif #kInfo.keywords# contains "#bizType#">
<cfset tempPath=#tempPath# & #fPath# & ",">
</cfif>
</cfloop>
<!--- Merge the files in the comma-separated list into a PDF output file called "taxMerge.pdf".
--->
<cfpdf action="merge" source="#tempPath#" destination="taxMerge.pdf" overwrite="yes"/>
<h3>Assembled Tax Document</h3>
<p>Click the following link to view your assembled tax document:</p>
<a href="http://localhost:8500/Lion/taxmerge.pdf">
<p>Your Assembled Tax Document</a></p>
Last updated 1/20/2012
action to retrieve the keywords
getInfo
action assembles the files in the list
merge
953

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents