IE9 32 位与 64 位 PDF 奇怪的文件打开行为
IE9 32bit vs 64bit PDF weird file open behaviour
我正在使用 Response.BinaryWrite(pdfResponse)
将在 MemoryStream
中创建的 PDF 文件发送回浏览器。这很好用。除了我注意到的一个细微差别。如果我在 32 位 IE9 中运行我的应用程序,PDF 将在浏览器中打开 window。但是,如果我使用 IE9 64 位查看应用程序,它会在 Adobe Reader 中加载(如我所愿)。完整回复如下:
byte[] pdfResponse = pdfStream.ToArray();
Response.Clear();
Response.ClearHeaders();
Response.AddHeader("Content-Type", "application/pdf");
Response.BinaryWrite(pdfResponse);
Response.Flush();
Response.End();
两个问题:
- 有什么方法可以强制在 Adobe Reader 中加载两个版本的 Adobe Reader? (我不需要考虑其他浏览器,因为这是仅适用于 IE9 的 Intranet 应用程序)
- 作为兴趣点,为什么这两个版本会有差异?
这与服务器端代码无关,与浏览器配置有关(实际上是用户偏好)。
没有 x64 Acrobat AX 控件。
最好的办法是提供 Content-Disposition header
以强制下载。然后用户可以决定打开或保存下载(将在已注册的 PDF 应用程序中打开)。
Response.AddHeader("Content-Disposition", "attachment; filename=mypdf.pdf");
(顺便说一句,允许网站在我的浏览器中任意打开 Acrobat 插件是我很久以前关闭的行为......两个词:攻击向量)
我刚发现:
> 重置“在浏览器中显示 PDF”首选项
In Reader or Acrobat, right-click the document window, and select
Page Display Preferences.
From the list at left, select Internet.
Deselect Display PDF In Browser, and then click OK.
Choose Edit > Preferences > Internet, select Display PDF In Browser, and then click OK.
> Try to open the PDF again from the website.
> 在 32 位版本的 Internet Explorer 或 Safari 中查看 PDF
Acrobat and Reader are 32-bit applications on Windows. If you try to
open a PDF in a 64-bit version of Internet Explorer, the PDF opens in
stand-alone Acrobat or Reader, not in Internet Explorer.
Note: Only Reader 10.1 or Acrobat 10.1 and later support Internet
Explorer 9.
To make sure that you are using a 32-bit version of Internet Explorer,
follow these steps:
In Internet Explorer, choose Help > About Internet Explorer. (In
some versions of Internet Explorer, select the Question mark in the
upper-right corner to select About Internet Explorer).
If you see "64-bit Edition" next to the version, then switch to the
32-bit version of Internet Explorer.
To switch to the 32-bit Internet Explorer, first exit 64-bit
Internet Explorer. Then double-click the program icon for the 32-bit
version:
C:\Program Files (x86)\Internet Explorer\iexplore.exe
也许这有帮助
我正在使用 Response.BinaryWrite(pdfResponse)
将在 MemoryStream
中创建的 PDF 文件发送回浏览器。这很好用。除了我注意到的一个细微差别。如果我在 32 位 IE9 中运行我的应用程序,PDF 将在浏览器中打开 window。但是,如果我使用 IE9 64 位查看应用程序,它会在 Adobe Reader 中加载(如我所愿)。完整回复如下:
byte[] pdfResponse = pdfStream.ToArray();
Response.Clear();
Response.ClearHeaders();
Response.AddHeader("Content-Type", "application/pdf");
Response.BinaryWrite(pdfResponse);
Response.Flush();
Response.End();
两个问题:
- 有什么方法可以强制在 Adobe Reader 中加载两个版本的 Adobe Reader? (我不需要考虑其他浏览器,因为这是仅适用于 IE9 的 Intranet 应用程序)
- 作为兴趣点,为什么这两个版本会有差异?
这与服务器端代码无关,与浏览器配置有关(实际上是用户偏好)。
没有 x64 Acrobat AX 控件。
最好的办法是提供 Content-Disposition header
以强制下载。然后用户可以决定打开或保存下载(将在已注册的 PDF 应用程序中打开)。
Response.AddHeader("Content-Disposition", "attachment; filename=mypdf.pdf");
(顺便说一句,允许网站在我的浏览器中任意打开 Acrobat 插件是我很久以前关闭的行为......两个词:攻击向量)
我刚发现:
> 重置“在浏览器中显示 PDF”首选项
In Reader or Acrobat, right-click the document window, and select Page Display Preferences. From the list at left, select Internet. Deselect Display PDF In Browser, and then click OK. Choose Edit > Preferences > Internet, select Display PDF In Browser, and then click OK.
> Try to open the PDF again from the website.
> 在 32 位版本的 Internet Explorer 或 Safari 中查看 PDF
Acrobat and Reader are 32-bit applications on Windows. If you try to open a PDF in a 64-bit version of Internet Explorer, the PDF opens in stand-alone Acrobat or Reader, not in Internet Explorer.
Note: Only Reader 10.1 or Acrobat 10.1 and later support Internet Explorer 9.
To make sure that you are using a 32-bit version of Internet Explorer, follow these steps:
In Internet Explorer, choose Help > About Internet Explorer. (In some versions of Internet Explorer, select the Question mark in the upper-right corner to select About Internet Explorer).
If you see "64-bit Edition" next to the version, then switch to the 32-bit version of Internet Explorer.
To switch to the 32-bit Internet Explorer, first exit 64-bit Internet Explorer. Then double-click the program icon for the 32-bit version:
C:\Program Files (x86)\Internet Explorer\iexplore.exe
也许这有帮助