ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 5th, 2004, 01:42 PM
drroluffs drroluffs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 12 drroluffs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Prob: Dialog Box with pdf File

I am trying to link to a pdf file but I want the open/save dialog box to first appear. I have been able to get this code to work fine with other file types but for all pdf files, the file just opens in the browser. I have tried various combinations of cfcontent types, I don't know what else to try.

Below is a copy of my current code.


<CFHEADER NAME="Content-Disposition" VALUE="attachment;filename=Trial.pdf">
<cfcontent type="unknown/unknown" file="c:\MyFolder\Trial.pdf" deletefile="no">

Please review the <a href="c:\MyFolder\Trial.pdf" target="_blank"> document </a>



For testing I have a pdf file on my PC, however, the actual link will be to a pdf file on another website (in case that makes a difference.)

Any advice would be greatly appreciated!!!

Reply With Quote
  #2  
Old August 5th, 2004, 01:46 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
You may not be able to do this, as I'm pretty sure the acrobat reader plugin will automatically open the pdf in the browser and there's nothing you can do about it. I believe the only way to save a pdf is to right click and choose "save".
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old August 5th, 2004, 01:50 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
Actually my bad, you may be able to do this but you can't put the cfcontent/cfheader link on the same page as the link to the pdf. What you really want to do is have a link that says something like

<a href="loadpdf.cfm?pdffile=mypdffilename.pdf">Review the File</a>

And then on loadpdf.cfm, you'd do the cfcontent...

<CFHEADER NAME="Content-Disposition" VALUE="attachment;filename=#url.pdffile#">
<cfcontent type="unknown/unknown" file="c:\MyFolder\#url.pdffile#" deletefile="no">
<cfabort>


This type of thing can take a lot of messing around with to get to work, and even then different browsers may handle it in different ways...

Reply With Quote
  #4  
Old August 5th, 2004, 03:57 PM
drroluffs drroluffs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 12 drroluffs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
AMAZING!!! Your suggestion worked - I am now able to get the save/open dialog box, however, another small issue. I am able to save the pdf file and then when I try to open it (or open it directly from the dialog box) I now get a message that says "This document contains no data". I confirmed that there is something in my pdf file that I am linking to and even tried linking to two different documents to verify the problem was not with the pdf file. Have you seen this issue?

Almost there....

Reply With Quote
  #5  
Old August 5th, 2004, 05:56 PM
drroluffs drroluffs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 12 drroluffs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
AMAZING!!! Your suggestion worked - I am now able to get the save/open dialog box, however, another small issue. I am able to save the pdf file and then when I try to open it (or open it directly from the dialog box) I now get a message that says "This document contains no data". I confirmed that there is something in my pdf file that I am linking to and even tried linking to two different documents to verify the problem was not with the pdf file.

It appears that by putting the pdf file name in one file and then calling the loadpdf.cfm file, it treats the pdf filename from the first file as if it were a new file/document with nothing it in.

Have you seen this issue?

Almost there....

Reply With Quote
  #6  
Old August 6th, 2004, 08:28 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
No, I haven't. You might have to play with it. Another option would be to offer 2 links next to the pdf, one that says "Download" and one that says "View". Then you could either do the download as you are doing now, or just open the pdf inline.

Reply With Quote
  #7  
Old August 26th, 2004, 12:36 PM
epicito epicito is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: USA
Posts: 2 epicito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
There you go

You are not downloading the file in a proper manner. Observe the actual size of the downloaded file and you'll see is a few bytes.

The following works fine:

<cfset yourFileName="whatever_name.whatever_extension">

<cfheader name="Content-Disposition" value="attachment;filename=#yourFileName#">

<cfcontent type="application/x-unknown" file="physical path to your file on the server\#yourFileName#">

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Prob: Dialog Box with pdf File


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT