ColdFusion 9.0 Resources |
cfpdfparamDescriptionProvides additional information for the cfpdf tag. The cfpdfparam tag applies only to the merge action of the cfpdf tag and is always a child tag of the cfpdf tag. Syntax<cfpdf action = "merge" ..> <cfpdfparam pages = "page number|page range|comma-separated page numbers" password = "user or owner password" source = "absolute or relative pathname to a PDF file|PDF document variable| cfdocument variable"> </cfpdf> Note: You can specify this
tag’s attributes in an attributeCollection attribute
whose value is a structure. Specify the structure name in the attributeCollection attribute
and use the tag’s attribute names as structure keys.
See alsocfdocument, cfdocumentsection, cfpdf, cfpdfform, cfpdfformparam, cfpdfsubform, cfprint, IsPDFFile, IsPDFObject Attributes
UsageUse the cfpdfparam tag to merge several PDF documents into one file. The cfpdfparam tag lets you specify the order of source files explicitly. You can use this tag to merge pages from multiple PDF document source files in different locations. The following code creates a single PDF document called combined.pdf that contains pages 1–3 and page 5 of the file abc.pdf, followed by all of the pages in xyz.pdf, a file in memory with the variable name myPDFvariable, and lastly pages 10–90 from the file abc.pdf. The password attribute applies only if the source file is password-protected: <cfpdf action="merge" destination="combined.pdf" overwrite="yes"> <cfpdfparam source="c:\abc.pdf" pages="1-3,5" password="adobe"> \\x <cfpdfparam source="myPDFvariable"> <cfpdfparam source="abc.pdf" pages="10-90" password="adobe"> </cfpdf> Note: When you use the cfpdfparam tag
with the cfpdfmerge action, you must
specify either the destination attribute or the name attribute
for the cfpdf tag.
ExampleThe following ColdFusion page creates a form for downloading tax forms and tax information booklets: <h3>Downloading Federal Tax Documents</h3> <p>Please choose the your type of business.</p> <!--- Create the ColdFusion form to determine which PDF documents to merge. ---> <table> <cfform action="cfpdfMergeAction.cfm" method="post"> <tr><td><cfinput type="radio" name="businessType" Value="SoleP"> Sole Proprieter</td></tr> <tr><td><cfinput type="radio" name="businessType" Value="Partner">Partnership</td></tr> <tr><td><cfinput type="radio" name="businessType" Value="SCorp">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 ColdFusion action page merges PDF files in different locations based on the selection in the form: <!--- Create a merged PDF document based on the selection in the form. ---> <cfpdf action="merge" name="taxDoc"> <cfif #form.businessType# is "SoleP"> <cfpdfparam source="taxForms\f2106ez.pdf"> <cfpdfparam source="taxForms\f1040.pdf"> <cfpdfparam source="taxForms\f1040sc.pdf"> <cfpdfparam source="taxInfo\i1040sc.pdf"> <cfpdfparam source="taxInfo\i2106.pdf"> <cfpdfparam source="taxInfo\i1040sc.pdf"> <cfpdfparam source="taxInfo\p535.pdf"> <cfpdfparam source="taxInfo\p560.pdf"> <cfpdfparam source="taxInfo\p334.pdf"> <cfelseif #form.businessType# is "Partner"> <cfpdfparam source="taxForms\f1065.pdf"> <cfpdfparam source="taxForms\f1065b.pdf"> <cfpdfparam source="taxForms\f1065bsk.pdf"> <cfpdfparam source="taxForms\f8804.pdf"> <cfpdfparam source="taxForms\f8825.pdf"> <cfpdfparam source="taxInfo\p535.pdf"> <cfpdfparam source="taxInfo\p560.pdf"> <cfpdfparam source="taxInfo\i1065bsk.pdf"> <cfelseif #form.businessType# is "SCorp"> <cfpdfparam source="taxForms\f1120s.pdf"> <cfpdfparam source="taxForms\f2553.pdf"> <cfpdfparam source="taxForms\f8453s.pdf"> <cfpdfparam source="taxForms\f8825.pdf"> <cfpdfparam source="taxInfo\i1120s.pdf"> <cfpdfparam source="taxInfo\p542.pdf"> <cfpdfparam source="taxInfo\p535.pdf"> <cfpdfparam source="taxInfo\p560.pdf"> </cfif> </cfpdf> <cfpdf action="write" source="taxDoc" destination="c:\taxDoc.PDF" overwrite="yes"/> Note: ColdFusion
automatically flattens form fields when you use the merge action of
the cfpdf tag.
|