English 中文(简体)
Error opening PDF in browser - what HTTP header values should I use for streaming a PDF over https?
原标题:

I have a J2EE webapp which is used to download a generated PDF served by an HTTP servlet. When running over SSL in production the users are getting the error message

There was an error opening this document. The file cannot be found.

in Acrobat when they choose to open the file in the browser instead of saving it to file. If they save the file there is no problem. The error only occurs in production which is an Oracle Application Server cluster behind an F5 BIG-IP router. In test the problem does not occur even over https.

The current headers being sent are

Content-disposition: attachment; filename=myfile.pdf
Pragma: public
Cache-control: must-revalidate

Has anyone experienced this problem in the past? What values should I be using for these headers? Should I be using inline content-disposition instead of attachment?

最佳回答

I fixed it by adding these 2 headers:

Pragma: public Cache-control: maxage=1

http://us.php.net/manual/en/function.header.php#83219

问题回答

It may help to ensure that the URL being called ends in ".pdf", or even "filename.pdf", as IE (aparently) uses the URL to determine filetype.





相关问题
How to upload and download file from a server using C#

I am developing a webpage in that the user can download their Resume for Edit. So I have a link to download the article. I use the following code for download. DataTable dt = user.getUserDetails(2); ...

Detecting PDF Download

I have recently added functionality for generating pdf reports to a web application. However the reports can be quite large and take some time to show the pdf download dialog. I want to show a spinner ...

Writing file to users giving sporadic error in IE

I have a very interesting issue with only specific IE implementations. I have an ASPX page that is used to write files down to the user, as part of the process the page uses the following code to ...

PHP - List of Excel files to download from Intranet Site?

I have a intranet site running PHP 5 that needs to list a folder containing only Excel files. Ideally the user needs to be able to input some search criteria (ie date) and the files would be filtered ...

Determine total size of SVN directory/trunk

Is there a way to count/calculate the total size of a svn directory if you were to checkout a revision? I have limited internet downloads so I need to know how big something is before I go and ...

Scala and html: download an image (*.jpg, etc) to Hard drive

I ve got a Scala program that downloads and parses html. I got the links to the image files form the html, Now I need to transfer those images to my hard drive. I m wondering what the best Scala ...

Downloading file with wxHTTP?

Im really stumped. Im using the wxHTTP class in wxWidgets to try and download two files. The first request succeeds but the second one fails when wxHTTP->GetInputStream is called. Between downloads, ...

热门标签