I have a cfdocument tag that looks something like this:
<cfdocument name="myPDF" format="PDF" ... >
...
</cfdocument>
I save the PDF in a variable using the name attribute, as I’m going to be using it in multiple places for multiple uses. (Attach to an email, display on the screen, etc.)
I want to display this pdf in the browser, just output it as if I had left out the name attribute in the cfdocument, but I can’t figure out how to do this. Using a cfoutput ( <cfoutput>#myPDF#</cfoutput> ) gives me an error – “ByteArray objects cannot be converted to strings.” Using a cfdump gives me a binary object. It seems the pdf is stored as binary… How can I force it to display on the screen as a pdf?
Found a solution (by looking elsewhere on our site where this was done) – used a cfcontent:
Update:
I actually discovered a slightly more straightforward way to do this: