Programming, Technology, Web Development, Whatever
Populating a PDF From ColdFusion
ColdFusion provides a lot of handy features that make it really easy to do something that seems incredibly complicated. Creating and populating a PDF dynamically is one of them.
Heres what you do:
Create a PDF with a form, that has fields that are not read only. You also need to name each field uniquely.
For this particular example I was making a PDF for a Bill of Lading.
Sample PDF Form
This PDF needs to be saved on the server in a location accessible to ColdFusion to be used as a template.
Next, populate the PDF with the following code:
<cfpdfform source="#sourcefile#" destination="#destinationfile#" action="populate" overwrite="no">
<cfpdfsubform name="form1">
<!--- Begin Field Params --->
<cfpdfformparam name="sampleFieldName" value="#someValue#" >
The cfpdfsubform is required. The default subform created by LiveCycle/Acrobat is form1, so its usually a safe bet to just go with that unless you’ve been messing around with the subforms. You can really make sure by going into the XML view of the PDF in LiveCycle.
You can read more about this tag and its uses here:
LiveDocs
| Print article | This entry was posted by Nathan on December 10, 2009 at 11:15 AM, and is filed under ColdFusion. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |