trifecta2k
asked on
How do I populate PDF with cfpdfformparam
I am trying to populate a pdf with ColdFusion. I've done this before using cfpdfformparam and it was fairly easy, however this time I just can seem to get it to work. The PDF has an array inside it and I don't know how to access it to place my data there. I've attached an image of the dump. I want to put something in the dob and name fields. I've also attached my code. Thanks for the help
<cfpdfform action="populate" source="RAF_final.pdf" destination="r_form_withData.pdf" overwrite="true" overwritedata="yes">
<cfpdfsubform name="form1">
<cfpdfsubform name="page1">
<cfpdfsubform name="resInfo1">
<cfpdfsubform name="Row1">
<cfpdfformparam name="dob" value="12/7/1954" />
<cfpdfformparam name="name" value="John Morgan" />
</cfpdfsubform>
</cfpdfsubform>
</cfpdfsubform>
</cfpdfsubform>
</cfpdfform>
Can you also attach you PDF ?
ASKER
I've attached the PDF
RAF-final.pdf
RAF-final.pdf
You have to defined an XML structure according to above .. remember ROW1 is an array which contains 2 items, and the second one contains the DOB and NAME..
Below is working.. it is not the fields that you are looking for though.. but you need to change the XML to define your structure...
Below is working.. it is not the fields that you are looking for though.. but you need to change the XML to define your structure...
<cfprocessingdirective suppresswhitespace="yes">
<cfxml variable="pdfxml">
<form1>
<page1>
<resInfo2>
<Row1>
<divorced>1</divorced>
<female>1</female>
</Row1>
</resInfo2>
</page1>
</form1>
</cfxml>
</cfprocessingdirective>
<cfpdfform action="populate" source="RAF-final.pdf" destination="r_form_withData.pdf" overwrite="true" overwritedata="yes" xmldata="#pdfxml#">
</cfpdfform>
ASKER
I tried that but I don't know how to access the array. I can do what you did, but resInfo2 doesn't have an array. Can you give me an example of how to add the DOB and Name using XML
My XML knowledge is limited, but you can
1. Wait for other Experts to help you out with it
2. Add XML ZONE to this question and XML experts can help you in building the correct structure.
3. Open another question regarding how to have the XML created.
1. Wait for other Experts to help you out with it
2. Add XML ZONE to this question and XML experts can help you in building the correct structure.
3. Open another question regarding how to have the XML created.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.