>>>>>問題<<<<<
因為有系統用iframe顯示PDF,但PDF有時卻并不能順利地在流覽器中顯示,而是跳出下載對話框,要求下載,給user帶來很多困擾,也給我們系統維護人員帶來了麻煩,用了兩天,查找IE打開PDF的一些規則,和大家分享一下 >>>>>分析<<<<<一.測試環境win7 32bit IE9foxit reader(version 3.2.1.0401,直接將以前安裝好的目錄Foxit Software打包,然後解壓在電腦上直接執行)adobe reader x(version 10.0.0,安裝包文件名:AdbeRdr1000_zh_TW.exe)二.原理說明
以下註冊表鍵值,決定IE是否直接打開PDFHKEY_CLASSES_ROOT\MIME\DataBase\Content Type\application/pdf\CLSID1.如果CLSID中是個錯的值,即在HKCR\CLSID中不存在(如隨便一個xxxxx),如果pdf的預設打開程式是foxit reader,那會根據foxit reader的設定,在流覽器中還是在外面開啟如果pdf的預設打開程式是adobe reader x,則不論設定如何,都會彈出下載對話框,在流覽器外面開啟2.如果CLSID值存在于HKCR\CLSID中,但是不是正確的foxit reader和adobe reader x的CLSID值
(測試過這兩個CLSID:{0000002F-0000-0000-C000-000000000046}:clsid中的第一個,{22D6F312-B0F6-11D0-94AB-0080C74C7E95}:Windows Media Player)則會彈出下載對話框,當用戶選擇【打開】時,不管pdf的默認程序是foxit reader,還是adobe reader x,都會在流覽器外面打開,而不管其是否有設定在流覽器中顯示PDF三.adobe reader x在流覽器中打開PDF的設定
adobe reader x的CLSID:{CA8A9780-280D-11CF-A24D-444553540000}以下鍵值不存在則會在流覽器中顯示(默認),存在則不會在流覽器中顯示,
HKCU\Software\Adobe\Acrobat Reader\10.0\Originals\bBrowserIntegrationPS:adobe reader x在流覽器有時PDF顯示不出來,這時可以通過【說明】/【修復adobe reader安裝】后, 重新開啟流覽器或重啟系統試一下。
{CA8A9780-280D-11CF-A24D-444553540000}內容
---------------------------------------------------------------------------------------------Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}]
@="Adobe PDF Reader""AppID"="{BBAA0E44-3862-490C-8E63-AC2D2D6EF733}"[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\Control]
@=""[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\DocObject]
@=""[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\EnableFullPage]
[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\EnableFullPage\.fdf]
@=""[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\EnableFullPage\.pdf]
@=""[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\EnableFullPage\.xdp]
@=""[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\EnableFullPage\.xfd]
@=""[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\EnableFullPage\.xfdf]
@=""[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\Implemented Categories]
[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\Implemented Categories\{7DD95801-9882-11CF-9FA9-00AA006C42C4}]
@=""[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\Implemented Categories\{7DD95802-9882-11CF-9FA9-00AA006C42C4}]
@=""[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\InprocServer32]
"ThreadingModel"="Apartment"@="C:\\Program Files\\Common Files\\Adobe\\Acrobat\\ActiveX\\AcroPDF.dll"[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\MiscStatus]
@="0"[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\MiscStatus\1]
@="131473"[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\ProgID]
@="AcroPDF.PDF.1"[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\Programmable]
@=""[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\ToolboxBitmap32]
@="C:\\PROGRA~1\\COMMON~1\\Adobe\\Acrobat\\ActiveX\\AcroPDF.dll, 102"[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\TypeLib]
@="{05BFD3F1-6319-4F30-B752-C7A22889BCC4}"[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\Version]
@="1.0"[HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\VersionIndependentProgID]
@="AcroPDF.PDF"---------------------------------------------------------------------------------------------關鍵是ProgID @="AcroPDF.PDF.1"
---------------------------------------------------------------------------------------------Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\AcroPDF.PDF.1]
@="Adobe PDF Reader""EditFlags"=hex:00,00,01,00[HKEY_CLASSES_ROOT\AcroPDF.PDF.1\CLSID]
@="{CA8A9780-280D-11CF-A24D-444553540000}"[HKEY_CLASSES_ROOT\AcroPDF.PDF.1\DocObject]
@=""--------------------------------------------------------------------------------------------- 四.foxit reader在流覽器中打開PDF的設定foxit reader的CLSID:{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}下面這些鍵值存在,則會在流覽器中打開,反之則會在流覽器外打開
---------------------------------------------------------------------------------------------Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}]
@="PDF Document"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\AuxUserType]
[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\AuxUserType\2]
@="PDF"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\AuxUserType\3]
@="Foxit Reader"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\DefaultExtension]
@=".pdf, PDF Files(*.pdf)"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\DefaultIcon]
@="C:\\Users\\C036503220A\\Downloads\\foxit\\Foxit Software\\Foxit Reader\\Foxit Reader.exe,1"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\DocObject]
@="0"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\InprocHandler]
@="ole2.dll"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\InprocHandler32]
@="ole32.dll"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\Insertable]
@=""[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\LocalServer]
@="C:\\Users\\C036503220A\\Downloads\\foxit\\Foxit Software\\Foxit Reader\\Foxit Reader.exe"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\LocalServer32]
@="C:\\Users\\C036503220A\\Downloads\\foxit\\Foxit Software\\Foxit Reader\\Foxit Reader.exe"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\MiscStatus]
@="32"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\Printable]
@=""[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\ProgID]
@="FoxitReader.Document"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\Verb]
[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\Verb\0]
@="&Edit,0,2"[HKEY_CLASSES_ROOT\CLSID\{14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E}\Verb\1]
@="&Open,0,2"---------------------------------------------------------------------------------------------至于
HKCU\Software\Foxit Software\Foxit Reader\MainFrame\DisplayInBrowser值為1,則foxit reader設定對話框中的【是否在流覽器中顯示】checkbox會勾上,值為0,則不勾上這個設定不影響foxit reader如何在IE中打開PDF 五.其它HKEY_CLASSES_ROOT\.pdf鍵,雖然在IE處理PDF時不起直接作用,但最好還是設定正確adobe reader x的設定---------------------------------------------------------------------------------------------Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\.pdf]
"Content Type"="application/pdf"@="AcroExch.Document"---------------------------------------------------------------------------------------------foxit reader的設定
---------------------------------------------------------------------------------------------Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\.pdf]@="FoxitReader.Document""Content Type"="application/pdf"--------------------------------------------------------------------------------------------- >>>>>結論<<<<<IE中一直彈出下載對話框,即使在adobe或foxit中已經有設定相關選項,但還是不能在流覽器中直接顯示。最直接的原因,可能就是HKEY_CLASSES_ROOT\MIME\DataBase\Content Type\application/pdf\CLSID設定錯誤將這個值設定為adobe或foxit正確的clsid,應該就可以解決這個問題了。