user2620804
user2620804

Reputation: 133

Opening PDF file after creating CFDocument

 <cfset filename = "c:\print" & ".pdf"> 

            <cfdocument 
                filename="#filename#" 
                overwrite="yes" 

After creating a cfdocument and storing it in my file directory above. How do I open the document in the browser just after the cfdoc is created?

Upvotes: 1

Views: 1240

Answers (1)

Leigh
Leigh

Reputation: 28873

If you really need to save it to a file and display it in the browser, use cfcontent with the file attribute.

<cfheader name="Content-Disposition" value="attachment; filename=someFileName.pdf" />
<cfcontent type="application/pdf" file="#filename#" />

Otherwise, just omit filename from your cfdocument call. Per the documentation:

... If you omit the filename attribute, ColdFusion displays the output in the browser.

Upvotes: 6

Related Questions