Whatever message this page gives is out now! Go check it out!
populate
<cfpdfform
required
name=" PDF document variable name"
action = "populate"
source = "PDF file pathname|byte array"
optional
XMLdata = "XML object|XML string|XML data filename|
URL that returns XML data"
destination = "output file pathname"
overwrite = "yes|no"/
fdf = "true|false> <!---New attribute that populates data in FDF format instead of
XML with subforms and params--->
fdfdata = "file name to be imported" <!--- New attribute populates data in FDF format
from the AcroForm--->
read
<cfpdfform
required
action = "read"
source = "pathname|byte array"
at least one of the following:
XMLdata = "variable name for XML data"
result = "structure containing form field values"
optional
overwrite = "yes|no"/>
fdfdata = "filename to be exported to"Attribute | Action | Req/Opt | Default | Description |
| name | NA | Optional | Specify the PDF document variable name, for example, myPDF. If the source is a PDF document variable, you cannot specify the name attribute again. | |
action | NA | Required | Action to perform on the source:
| |
destination | populate | Optional | Write to browser | Pathname for the output file. You can specify an absolute pathname or a pathname relative to the context root. The file extension must be PDF or XDP. The file extension determines the format of the file. (The XDP format applies only to LiveCycle forms.)If you do not specify the destination, ColdFusion displays the form in the browser.Do not specify the destination when you embed a form in a PDF document. |
overwrite | populate read | Optional | no | Specifies whether to overwrite the destination file (if action="populate") or the data file (if action="read"):
|
overwriteData | populate | Optional | no | Specifies whether to overwrite existing data in PDF form fields with data from the data source:
Note: The flag, overwriteData="false" does not work as expected if you are reading the file using xmlData or fdfData. This behavior is seen in ColdFusion (2018 release), ColdFusion (2016 release), and ColdFusion 11. |
result | read | Optional(see Description) | ColdFusion structure that contains the form field values.Specify the XMLdata attribute or the result attribute; you can specify both. | |
source | populate read | Required | Pathname of the source PDF (absolute on-disk or in-memory path, or path relative to the context root) or byte array representing a PDF. | |
XMLdata | populate read | Optional(see Description) | Pathname for the XML data file.
| |
fdf | populate | Optional | false | If set to true, the system creates FDF with subforms and params instead of an XML |
fdfdata | populateread | Optional | For populate, you specify the file name from where the FDF data is imported. For read, you specify the file name where the FDF data is exported. |
<cfpdfform source="c:\payslipTemplate.pdf" action="populate" XMLdata="c:\formdata.xml"/><!--- Specify an XML file to populate a PDF form. --->
<cfpdfform source="c:\payslipTemplate.pdf"
destination="c:\employeeid123.pdf" action="populate"
XMLdata="c:\formdata.xml"/><cfpdfform source= "#sourcefile#" action="populate" XMLdata=
"http://test1.com/xyz" destination="#resultfile#" overwrite="true"/><!--- Specify a an XML file to populate a PDF form. --->
<cfpdfform source="c:\payslipTemplate.pdf"
destination="c:\employeeid123.xdp" action="populate"
XMLdata="c:\formdata.xml"/><!--- This example shows how to populate two fields in a form created in Acrobat. --->
<cfpdfform source="c:\payslipTemplate.pdf"
destination="c:\employeeid123.pdf" action="populate">
<cfpdfformparam name="employeeId" value="123">
<cfpdfformparam name="salary" value="$85,000">
</cfpdfform><!--- This example shows how to populate two fields in a LiveCycle form.
--->
<cfpdfform source="c:\payslipTemplate.pdf"
destination="c:\employeeid123.pdf" action="populate">
<cfpdfsubform name="form1">
<cfpdfformparam name="employeeId" value="123">
<cfpdfformparam name="salary" value="$85,000">
</cfpdfsubform>
</cfpdfform><cfpdfform source= "write_acrroform.pdf" action="populate" fdfdata="abc.fdf" destination="hello.pdf">
</cfpdfform><cfpdfform source="acroform2.pdf" destination="source_result17.pdf" action="populate" overwrite="true" fdf="true">
<cfpdfsubform name="Text1">
<cfpdfsubform name="0">
<cfpdfformparam name="0" value="Test1.0.0">
<cfpdfformparam name="1" value="Test1.0.1">
<cfpdfformparam name="2" value="Test1.0.2">
</cfpdfsubform>
<cfpdfsubform name="1">
<cfpdfformparam name="0" value="Test1.1.0">
<cfpdfformparam name="1" value="Test1.1.1">
<cfpdfformparam name="2" value="Test1.1.2">
</cfpdfsubform>
</cfpdfsubform>
<cfpdfsubform name="Text2">
<cfpdfformparam name="0" value="Test2.0">
<cfpdfformparam name="1" value="Test2.1">
<cfpdfformparam name="2" value="Test2.2">
<cfpdfformparam name="3" value="Test2.3">
</cfpdfsubform>
<cfpdfformparam name="Text3" value="Test3">
<cfpdfformparam name="Text4" value="Test4">
<cfpdfformparam name="checkbox1" value="Yes">
<cfpdfformparam name="listbox1" value="item4">
<cfpdfformparam name="radiobutton1" value="2">
</cfpdfform><!--- Use the read action to retrieve the values from the saved PDF. --->
<cfpdfform source="c:\employeeid123.pdf" result="resultStruct" action="read"/><cfdump var="#resultStruct#"><cfpdfform source="c:\employeeid123.pdf" result="c:\employeeid123.xml" overwrite="yes"
action="read"/><cfpdfform source="c:\employeeid123.pdf" XMLdata="myXMLdata" action="read"/><cfset sourcefile = "Grant Application Updated.pdf">
<cfset resultfile = "Expandpath('datafile_result1.xml')">
<!--- Use the cfpdfform tag to read data extracted from a form into an XML data variable and
generate a result structure. --->
<cfpdfform source= "#sourcefile#" action="read" xmldata="xmldata" result="resultstruct"/>
<!--- Use the cffile tag to write the XML data to a file. --->
<cffile action="write"file="#resultfile#" output="#xmldata#">
<!---- Use the cfdump tag to display the result structure. --->
<cfdump var="#resultstruct#"><!--- The following code reads the submitted PDF file and generates a result structure called
fields. --->
<cfpdfform source="#PDF.content#" action="read" result="fields"/><cfdump var="#fields#"><cfset empForm="#fields.form1#"><cfpdfform action="populate" source="#PDF.content#"
destination="timesheets\#empForm.txtsheet#.pdf" overwrite="yes"/><cfdump var="#FORM.form1#"><cfpdfform source= "acroform_export.pdf" action="read" fdfdata="abc.fdf" >
</cfpdfform><!--- The following code extracts data from the cfdocexamples database based
on a username entered in a login form. --->
<cfquery name="getEmpInfo" datasource="cfdocexamples">
SELECT * FROM EMPLOYEES
WHERE EMAIL = <cfqueryparam value="#form.username#">
</cfquery>
<!--- The following code creates a PDF document with headers
and footers. --->
<cfdocument format="pdf">
<cfdocumentitem type="header">
<font size="-1" align="center"><i>Nondisclosure Agreement</i></font>
</cfdocumentitem>
<cfdocumentitem type="footer">
<font size="-1"><i>Page <cfoutput>#cfdocument.currentpagenumber# of
#cfdocument.totalpagecount#</cfoutput></i></font>
</cfdocumentitem>
<!--- The following code creates the first section in the PDF document. --->
<cfdocumentsection>
<h3>Employee Nondisclosure Agreement</h3>
<p>Please verify the information in the enclosed form. Make any of the
necessary changes in the online form and click the <b>Print</b> button.
Sign and date the last page. Staple the pages together and return the
completed form to your manager.</p>
</cfdocumentsection>
<!--- The following code embeds an interactive PDF form within the PDF
document with fields populated by the database query. The cfpdpfform tag
automatically creates a section in the PDF document. Do not embed the
cfpdfform within cfdocumentsection tags. --->
<cfpdfform action="populate" source="c:\forms\embed.pdf">
<cfpdfsubform name="form1">
<cfpdfformparam name="txtEmpName" value="#getEmpInfo.FIRSTNAME#
#getEmpInfo.LASTNAME#">
<cfpdfformparam name="txtDeptName" value="#getEmpInfo.DEPARTMENT#">
<cfpdfformparam name="txtEmail" value="#getEmpInfo.IM_ID#">
<cfpdfformparam name="txtPhoneNum" value="#getEmpInfo.PHONE#">
<cfpdfformparam name="txtManagerName" value="Randy Nielsen">
</cfpdfsubform>
</cfpdfform>
<!--- The following code creates the last document section. Page numbering
resumes in this section. --->
<cfdocumentsection>
<p>I, <cfoutput>#getEmpInfo.FIRSTNAME# #getEmpInfo.LASTNAME#</cfoutput>,
hereby attest that the information in this document is accurate and complete.</p>
<br/><br/>
<table border="0" cellpadding="20">
<tr><td width="300">
<hr />
<p><i>Signature</i></p></td>
<td width="150"><hr />
<p><i>Today's Date</i></p></td></tr>
</cfdocumentsection>
</cfdocument>