Reputation: 2316
I'm working on a web app that allows users to downloaded dynamically generated PDF files.
This works fine in IE8 and Firefox but fails in IE6 with Adobe Reader giving the message "there was an error opening this document. this file cannot be found"
If I save the file to disk first then it opens fine in Reader.
I've given the file a simple short filename, without spaces so not sure what else to try. Any suggestions are very welcome.
Further info: PDF is generated in asp.net code using the abcpdf plugin
Upvotes: 1
Views: 1242
Reputation: 1
IMHO that's a header interpretation problem. I'm not very familiar or fond of ASP.NET but at least in PHP you need to have these:
ob_start(); (* should be equivalent to HttpContext.Current.Response.Buffer = true *)
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=somefile.pdf');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
//header('Content-Length: ' . filesize($file));
ob_flush(); (* should be equivalent to HttpContext.Current.Response.Flush() *)
** output the pdf contents here
(* header() should be similar to HttpContext.Current.Response.AddHeader() function *)
Note that setting Content-Length:
together with content-disposition:
attachment might fail to work in Safari and IE.
Hope it helps...
Upvotes: 0
Reputation: 29020
i think i have observed such most annoying behavior (bug) in IE6 and if i recollect, the reason for the error was that the file was not stored in the cache but expired/deleted right away. Check the following:
Upvotes: 0
Reputation: 2923
Maybe because of timeout setting in Adobe Reader Activex for IE. You respond the browser with a partially finished document then your program took some time to continue responding for the rest of document and Adobe Reader timeoutted. Try to generating entire PDF document and then respond to http request. for example in php.
$s = "";
for(int i=0;i<10;i++)
$s .= "1";
echo #s;
instead of
for(int i=0;i<10;i++)
echo "1";
Upvotes: 0
Reputation: 13769
Is there really a need for IE6 support on your webpage? Would a valid solution be to simply require users to upgrade to a later version of IE?
IE6 died two and a half months ago. (IE6 Funeral)
Upvotes: 1