Help populating a pdf with coldfusion
Thank you in advance to anyone who can help this coldfusion noob.
What I am trying to do seems easy enough but clearly I am having very serious problems. ;D
I am trying to populate a pdf with data from a database.
//Here is the page that lists all the users and allows a link to the user details
//this is working fine
<cfquery name="GetUsers" datasource="[ommitted]">
SELECT ChildAssessmentID,FirstName, LastName
FROM ChildAssessments
</cfquery>
<h4>Child Assessment List</h4>
<table>
<tr>
<th>User ID</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
<cfoutput query="GetUsers">
<tr>
<td><a href="pdf.cfm?ChildAssessmentID=#ChildAssessmentID#">#ChildAssessmentID#</a></td>
<td>#FirstName#</td>
<td>#LastName#</td>
</tr>
</cfoutput>
</table>
//end page
//Here is my query getting the details of user with the ChildAssessmentID
//this seems to be making the correct query but is not working with the pdf
<cfquery name="getuserdetails" datasource="[omitted]">
select FirstName, LastName
from ChildAssessments where ChildAssessmentID=#URL.ChildAssessmentID#
</cfquery>
Here is my cfpdfform code
//pdf.cfm
<cfpdfform action="populate" source="pdf/testform.pdf" overwrite="yes">
<cfpdfsubform name="form1" >
<cfpdfformparam name="ChildAssessmentID" value="#URL.ChildAssessmentID#">
<cfpdfformparam name="FirstName" value="#getuserdetails.FirstName#">
<cfpdfformparam name="LastName" value="#getuserdetails.LastName#">
</cfpdfsubform>
</cfpdfform>
The form I am trying to populate (pdftestform.pdf) displays the top record in LiveCycleDesigner using "Preview Mode", but does not display data using the coldfusion.
I hope this makes sense.
dottomm
Junior Poster in Training
89 posts since Nov 2007
Reputation Points: 9
Solved Threads: 5
Have you tried cfdocument? You can generate PDF files using that tag. Let me know.
cfwebdeveloper
Junior Poster in Training
78 posts since May 2011
Reputation Points: 19
Solved Threads: 8
Thank you cfwebedeveloper.
Yes, I've tried the cfdocument tag, and it is creating pdf forms for me, but I'd like to get data from a database to populate the pdf form based on the user id that is passed in the url.
dottomm
Junior Poster in Training
89 posts since Nov 2007
Reputation Points: 9
Solved Threads: 5
Dumb question but are you sure the query is dumping out data? Try a cfdump on the query.
cfwebdeveloper
Junior Poster in Training
78 posts since May 2011
Reputation Points: 19
Solved Threads: 8
Not a dumb question. Thank you. I had to double check. Yes. It is dumping the query based on userID passed in URL. I can't figure out why it won 't appear in a pdf. It seems like I'm so close.
thanks again!
dottomm
Junior Poster in Training
89 posts since Nov 2007
Reputation Points: 9
Solved Threads: 5
Are you sure you are getting results back from the database? Sounds like you are getting no results back from the database. Do a quick cfoutput of getuserdetails.recordcount and see if it 0 or 1.
cfwebdeveloper
Junior Poster in Training
78 posts since May 2011
Reputation Points: 19
Solved Threads: 8
dottomm
Junior Poster in Training
89 posts since Nov 2007
Reputation Points: 9
Solved Threads: 5
Weird...I will try to replicate this once I get home from work. I havn't messed with cfpdfform before but would be nice to figure out this issue.
cfwebdeveloper
Junior Poster in Training
78 posts since May 2011
Reputation Points: 19
Solved Threads: 8
cfwebdeveloper
Junior Poster in Training
78 posts since May 2011
Reputation Points: 19
Solved Threads: 8
Thanks for your help! I really appreciate it!
dottomm
Junior Poster in Training
89 posts since Nov 2007
Reputation Points: 9
Solved Threads: 5
dottomm
Junior Poster in Training
89 posts since Nov 2007
Reputation Points: 9
Solved Threads: 5
Totally did not get around to this, busy studying for a certification. Did you resolve your issue yet?
cfwebdeveloper
Junior Poster in Training
78 posts since May 2011
Reputation Points: 19
Solved Threads: 8
Hi - Thanks for everyones help. I did resolve my problem. Using the example from adobe cfdeveloper pointed out.
Complete Total user error. The Adobe documentation is correct.
dottomm
Junior Poster in Training
89 posts since Nov 2007
Reputation Points: 9
Solved Threads: 5