• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: PDF IE & filedownload
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PDF IE & filedownload


  • Subject: Re: PDF IE & filedownload
  • From: David Holt <email@hidden>
  • Date: Fri, 2 Sep 2005 08:53:42 -0700

Here's my method: pay close attention to the cache-control and pragma lines. They were the key for me to get this to work with IE. There's a couple of entries on this at WOCode

public void appendToResponse( WOResponse aResponse, WOContext aContext) {

super.appendToResponse(aResponse, aContext);
try {


// this is to stop the IE problems:
aResponse.disableClientCaching();
aResponse.removeHeadersForKey("Cache-Control");
aResponse.removeHeadersForKey("pragma");


aResponse.setContent(docToDownload.getFile());
// Set the headers for browser want to save instead of displaying

aResponse.setHeader("application/octet-stream", "content-type");


// Give the data a default name to save as
String contentDisposition = "\"";
aResponse.setHeader(contentDisposition, "content-disposition");
} catch(Exception e) {

aResponse.setContent("There was a problem downloading the file you specified. File path was: "+ docToDownload.getFullyQualifiedFilePath());
e.printStackTrace();
}


}

see also:

http://wodeveloper.com/omniLists/webobjects-dev/2002/June/msg00627.html

David


On 2 Sep 2005, at 12:15 AM, Javier Solórzano wrote:

I'm using the folowing Filedownloader.java component to display inline pdf of a frame. It runs great with Safari and Firefox (both PC & Mac) with Quicktime, Adobe Reader or the Shuberit plugin to display inline pdf but it displays garbage when I use IE and Adobe on a PC. I would swear it worked once (we seldom use IE, but clients insists on using it...) but now I only get garbage.

public class FileDownloader extends WOComponent {

    public FileDownloader(WOContext context) {
        super(context);
    }
    
    public void appendToResponse(WOResponse response, WOContext context) {
        if( session() != null) {
            if(((Session)session()).documentImage != null) {
                if(((Session)session()).documentImage.imageData() !=null && ((Session)session()).documentImage.mimeType() !=null) {
                    response.setContent(((Session)session()).documentImage.imageData());
                    response.setHeader(((Session)session()).documentImage.mimeType(), "content-type");
                    response.setHeader("content-disposition"); 
                    response.setHeader("documentserver.pdf");
                    return;
                }
            }
        }
        super.appendToResponse(response,context);
    }

}

Any pointers would be appreciated, since I've been staying up late night the past few days with no joy. The easy answer would be f*** IE, but alas, I'm stuck with it...

Cheers,

JS _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: PDF IE & filedownload
      • From: Javier Solórzano <email@hidden>
References: 
 >PDF IE & filedownload (From: Javier Solórzano <email@hidden>)

  • Prev by Date: Re: PDF IE & filedownload
  • Next by Date: MEETING: Chicago - Tuesday, September 6th
  • Previous by thread: Re: PDF IE & filedownload
  • Next by thread: Re: PDF IE & filedownload
  • Index(es):
    • Date
    • Thread