Copy link to clipboard
Copied
I'm creating a PDF with cfpdf, then using cfhttp, cfheader, and cfcontent to open up a save dialog. How do I get the page to move to another page after the save dialog is shown? As soon as I add cfcontent to the page, all other processing is stopped (the save dialog pops up, but I can't create a button to move to the next page, or move there automatically).
<cfhttp url="http://XXX.com/#variables.GeneratedPDFName#"
method="get"
getAsBinary="yes" />
<cfheader name="Content-Disposition" value="attachment; filename=File.pdf" />
<cfcontent type="application/pdf" variable="#cfhttp.fileContent#" />
Thanks
Copy link to clipboard
Copied
This is working as expected. The page stops processing because the content-type is changed and you are now streaming a file. The rest of the markup is ignored.
There are a number of pages that give information to this already:
If using CFCONTENT and CFHEADER to stream an Excel file, will Javascript still work?
http://stackoverflow.com/questions/24557322/need-new-page-for-cfcontent-call
Using CFContent's Variable Attribute Stops All Further Processing
Also dont forget the documentation:
Adobe ColdFusion 9 * cfcontent
variable | Optional | Name of a ColdFusion binary variable whose contents can be displayed by the browser, such as the contents of a chart generated by the cfchart tag or a PDF or Excel file retrieved by a cffile action="readBinary" tag. When you use this attribute, any other output on the current CFML page is ignored; only the contents of the file are sent to the client. |
etc etc