[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

Printing a pdf Need to change the save As filename

I'm using a windows.print button command on a cfm page.
When selecting the printer eg "adobe pdf" I recieve the save as dialogue.
I'd like to have the filename automatically be something from my page form data rather than the current filename.. so that when a page is printed it has a dynammically assigned filename  

is there a command in my button code to pass along the filename i want

0
Warez_Willy
Asked:
Warez_Willy
  • 6
  • 6
  • 2
1 Solution
 
JeffHowdenCommented:
Sorry, but no, there is not way to do what you're asking.
0
 
Warez_WillyAuthor Commented:
Bugger!

SO Um.. does that mean I award the points to you or do I withdraw the question.

Not sure what the etiquette is here.
0
 
pcaiooCommented:
if you want to save the file as a pdf file you can try

<cfheader name="Content-Disposition" value="filename=#FileName#">
<cfcontent type="application/pdf" file="#FileLocation##FileID#">
<cfabort>

or

<cfdocument name="test" format="pdf" >
<cfinclude template="mycode.cfm">
</cfdocument>
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
JeffHowdenCommented:
I fail to see, pcaioo, how your solution addresses anything that's being done client-side with a print/save as dialog.
0
 
pcaiooCommented:
will show a file name save dialoge box for first solution
and will show the pdf in acrobe in second solution.

hope you can integrat into your code
0
 
JeffHowdenCommented:
Neither solution comes close to what the OP is asking.  He's asking how to affect the filename in a save as dialog that's caused by his print to pdf print driver.  All of this is occurring client-side with a document (non-pdf) that's already loaded.

So, your solution would work if he was trying to download something from the server, but that's not what's going on here.
0
 
pcaiooCommented:
<cfdocument name="test" format="pdf" >
<cfinclude template="mycode.cfm">
</cfdocument>
this already will give you a file name to save
0
 
pcaiooCommented:
this will give you what you want . this already the full code...

<cfhttp method="GET" url="http://yourdomainname/pdfdoc.cfm?#CGI.QUERY_STRING#" timeout="5"></cfhttp>
<cffile action="write" file="c:\#CGI.QUERY_STRING#.pdf" output="#CFHTTP.FileContent#">
<cfheader name="Content-Disposition" value="attachment;filename=#CGI.QUERY_STRING#.pdf" >
<cfcontent type="application/pdf" file="c:\#URL.AID#.pdf" deleteFile = "Yes" >
<cfabort>
0
 
pcaiooCommented:
and this is inside pdfdoc.cfm

<cfdocument format="pdf" pagetype="a4" encryption="128-bit" permissions="allowprinting">
<cfinclude template="#URL.doc#.cfm">
</cfdocument>

0
 
JeffHowdenCommented:
pcaioo, you're spinning your wheels.  The point you're missing is that the OP is looking for a client-side solution (that doesn't exist) for naming the file in a print to PDF dialog.  He is *not* clicking a link to a downloadable file or another page that'll be delivered as a PDF.  He is wanting to print the current page using a print to PDF driver and control the filename displayed in the dialog.  It just can't be done.
0
 
pcaiooCommented:
<cfdocument format="pdf" pagetype="a4" encryption="128-bit" permissions="allowprinting">
<cfinclude template="#URL.doc#.cfm">
</cfdocument>

can be call from a button and save as pdf
0
 
JeffHowdenCommented:
Yes, it could, but the nature of the question is about something happening entirely client-side.
0
 
Warez_WillyAuthor Commented:
Ah now this is better!! I feel like I'm getting my money's worth now. Jeff, thankyou (you do understand my question) and pcaioo, thankyou, there's some code there I hadn't thought of trying but it's not going to solve this particular problem.. I still am unsure how best to distribute the points... Maybe "it can't be done" is the answer and we'll put this one to bed..??
0
 
JeffHowdenCommented:
Based on the nature of your original questions, warez_willy, I'd say it's not doable, choose the response that helped the most, and move on.  I don't know that there's any other solution here.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 6
  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now