【发布时间】:2010-06-01 14:28:52
【问题描述】:
我正在尝试向用户显示来自数据库 (byte[]) 的 PDF。
我正在使用下面的代码来呈现 PDF。它给我 PDF 作为二进制文本,如下所示。它不是在 PDF 应用程序中打开,而是将 PDF 呈现为文本。
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
//Response.AddHeader("Content-Length", fileToDownload.Length.ToString());
//Response.AddHeader("Content-Disposition", "inline; name=RemoteUserGuide.pdf");
Response.AppendHeader("content-length", fileToDownload.Length.ToString());
Response.ContentType = "application/pdf";
Response.BinaryWrite(fileToDownload);
Response.Flush();
////Response.Close();
Response.End();
更新:刚刚注意到,此应用程序页面在 CHROME 中正确呈现 PDF,但仍在 IE 中显示文本。 (服务器上没有 FF3 来测试)。可能是浏览器的问题?
【问题讨论】:
-
你用什么浏览器?
-
请看我的更新...谢谢。