At
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-g-h/cfhtmltopdf.html
it clearly shows the destination as being within
<cfhtmltopdf>
encryption = "AES_128|RC4_40|RC4_128|RC4_128M|None"
source = "URL|pathname absolute or relative to web root"
destination = "filename"
language="language name"
marginBottom = "number"
marginLeft = "number"
marginRight = "number"
marginTop = "number"
name = "output variable name"
orientation = "portrait|landscape"
overwrite = "yes|no"
ownerPassword = "password"
pageHeight = "page height in inches(default)"
pageType = "page type"
pageWidth = "page width in inches(default)"
permissions = "permission list"
saveAsName = "PDF filename"
unit = "in|cm"
userPassword = "password"
HTML and CFML code
</cfhtmltopdf>
I tried without writing the file but got a JSON error too.
How else would you do it?
The doc is mistaken. You've been a cfml coder for years (I've just noticed your account name). Do you not recognize the mistake, even from what I said?
Let me be explicit for you. Please first change this:
<cfhtmltopdf>
source = "c:\inetpub\wwwroot\webstuff\coldfusion\images\pdffile.html"
destination = "c:\inetpub\wwwroot\webstuff\coldfusion\images\pdffile.pdf"
</cfhtmltopdf>
To this:
<cfhtmltopdf
source = "c:\inetpub\wwwroot\webstuff\coldfusion\images\pdffile.html"
destination = "c:\inetpub\wwwroot\webstuff\coldfusion\images\pdffile.pdf">
</cfhtmltopdf>
You may even be able to leave off the closing tag. I'm short of time to run a test for you.
You could also leave off the source attribute and put your #invoice# var between the pair of cfhtmltopdf tags.
Finally, you have not addressed my suggestion that you look at the intermediate html file, to see how it looks. First look in a editor, then in a browser. Anything amiss about it?
The cf tag will of course be trying to create a pdf from that html, so if the browse has any errors, so will cf. But even if it renders well, look at the source in that html. There may be something your human eyes recognize as an error that the browser may not, but it seems cf has a problem with.