This post is more than 2 years old.
Hi, I am learning from you article and havea a requirement to create and email/print PDF file out of an online html report. I am trying the code bellow, but it doesn't work. What am I doing wrong? Would you let me know, please, how to make it work?
Let's take a look at his code:
<cfdocument format="PDF" name="c:\temp\myReport"> <html> ... my html report is here ... </html> </cfdocument>
<cfpdf action="write" source="c:\temp\myReport" destination="c:\temp\myPDF.pdf">
I hate to say RTFM, but this is a perfect case where it would have helped. The docs for CFDOCUMENT state that the name attribute allows you to specify a variable to store the PDF created. It isn't a filename, but rather a variable name. If you run the code, the error makes mention of it: The string c:\temp\myReport is not a valid ColdFusion variable name.
The solution is simple - switch to filename.