coldfusioncoldfusion-8cfdocument

Cfdocument being served by server despite being in cfsavecontent


It seems that when I use the <cfsavecontent> tag, the output of that is being served by the server (without the variable being outputted), which, to me, kind of defeats the purpose of <cfsavecontent>.

If this is important: my application uses ColdSpring, ModelGlue and Transfer ORM.

Here's my example code in a function:

<cfsavecontent variable="testvar">
<cfinclude template="test.cfm" />
</cfsavecontent>
<cfreturn testvar>

And the template:

<cfdocument format="PDF" pagetype="A4" orientation="portrait" unit="cm">
<cfoutput>
<!--- PDF content here --->
</cfoutput>
</cfdocument>

The PDF content is being parsed by my browser (Google Chrome), while the view hasn't even been loaded in. How can I best prevent this from happening?

Just to clarify: I am not outputting the #testvar# variable yet in this code, though it seems it loads the template in the browser anyways.


Solution

  • As I also needed to make multiple PDF documents merge, I ended up doing the following. Many thanks to Adam Cameron for providing the solution to my initial issue.

    This got me to where I am.