Hi
I'm having a strange problem
I have a webapp that can generate different file types(PDF, XLS, CSV)
Once file is generated, the response is sent where browser asked to open or save file. Save works for all files(including PDF), no problem.
Open however, works for every type except PDF. When clicking open, adobe reader starts, then it displays a popup error message saying: "There was an error opening this document. This file cannot be found".
I set content type to application/pdf. Although I've tried a bunch more:
application/download, application/force-download, application/octet-stream
application/x-unknown, multipart/download, etc.
I set Cache-control header to
rivate, no-store, no-cache,
must-revalidate.
Pragma = no-cache
Content-disposition is set to : "attachment;filename="someFileName.pdf"
content-length is correctly set.
To work around an Excel problem I had to add extra url mapping where a request url which ended in the filename that matched the filename passed in content-disposition would generate the same file again. This is a known workaround for how retarded windows/Office/IE works, as Excel retrieves the file itself from the web server using the filename even if the browser has retrieved the file already. This only seems to happen with attached, not inline. Inline is not an option for me however.
This "filename URL" workaround is also available to whatever other programs opens PDF files, like Adobe reader. And looking at my logging I see adobe reader sending the request to get the document with the filename as the last part of the URI. The document is generated and sent back. So in effect it is generated twice. Which his fine, if it only worked!!
On linux everything works fine, PDFs opens fine in both ghost view or acroread. Quality programs!
I've run out of ideas, anyone see what I've forgotten?
Help!