简体   繁体   中英

IE9 32bit vs 64bit PDF weird file open behaviour

I am sending a PDF file which has been created in a MemoryStream back to the browser using Response.BinaryWrite(pdfResponse) . This works fine. Except for one small nuance I have noticed. If I run my application in 32bit IE9, the PDF opens in a browser window. However, if I am using IE9 64bit to view the app, it loads (like I desire) in Adobe Reader. The full response is below:

byte[] pdfResponse = pdfStream.ToArray();
Response.Clear();
Response.ClearHeaders();
Response.AddHeader("Content-Type", "application/pdf");
Response.BinaryWrite(pdfResponse);
Response.Flush();
Response.End();

Two questions:

  1. Is there any way to force Adobe Reader to load in both versions in Adobe Reader? (I do NOT need to consider other browsers as this is for IE9 only intranet app)
  2. As a point of interest, why would there be a difference in these two versions?

This has nothing to do with the server side code and everything to do with the configuration of the browser (effectively it's a user preference).

There is no x64 Acrobat AX control.

Your best bet is to supply a Content-Disposition header to force download. User then can decide to open or save the download (which will open in the registered app for PDF).

Response.AddHeader("Content-Disposition", "attachment; filename=mypdf.pdf");

(as an aside, allowing websites to arbitrarily open the Acrobat plugin in my browser is a behaviour I turned off a long time ago... Two words: attack vector)

What I just found:

> Reset the Display PDF In Browser preference

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.

> View PDF in 32-bit version of Internet Explorer or Safari

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

Maybe that helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM