You can use the cfpdfform tag inside the cfdocument tag to embed an existing interactive PDF form in a PDF document. This is useful to include additional information with a standard interactive form. For example, a company might have a generic PDF form for maintaining employee information. You could reuse this form in different contexts to ensure the employee information is current.
To create the static PDF pages, use the cfdocument tag and cfdocumentsection tags. Then use the cfpdfform tag in the cfdocument tag to create an interactive form in the PDF document. When the user updates the form and prints or submits it, all of the pages in the document, including the static PDF pages, are printed or submitted with the form.
Use at least one cfdocumentsection tag with the cfpdfform tag, but do not place the cfpdfform tag within the cfdocumentsection tag. Instead, insure that the cfpdfform and cfdocumentsection tags are at the same level, the following example shows:
<cfdocument format="pdf"> <cfdocumentitem type="header"> <font size="+1">This is the Header</font> </cfdocumentitem> <cfdocumentitem type="footer"> <font size="+1">This is the Footer</font> </cfdocumentitem> <cfdocumentsection> <p>This is the first document section.</p> </cfdocumentsection> <cfpdfform source="c:\forms\embed.pdf" action="populate"> <cfpdfsubform name="form1"> <cfpdfformparam name="txtManagerName" value="Janis Joplin"> <cfpdfformparam name="txtDepartment" value="Sales"> </cfpdfsubform> </cfpdfform> <cfdocumentsection> <p>This is another section</p> </cfdocumentsection> </cfdocument>
The contents of the cfpdfform tag start on a new page. Any text or code directly after the cfdocument tag and before the cfpdfform tag applies to the document sections but not to the interactive PDF form in the cfpdfform tag.
The headers and footers that are part of the embedded PDF form do not apply to the rest of the PDF document, and the headers and footers that are defined in the cfdocument tag do not apply to the interactive form. However, header and footer information defined in the cfdocumentitem tags resumes in the sections that follow the embedded form and account for the pages in the embedded form.