javascript PDF.js 不适用于 IE9

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12537773/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 16:28:15  来源:igfitidea点击:

PDF.js not working on IE9

javascriptpdfinternet-explorer-9pdf.js

提问by jfreak53

Does anyone have any clue how to get PDF.js to work on IE 9? I have tried everything I can think of to get it to work and no go. I have downloaded the hack.js file and tried adding it before and after pdf.js and before and after viewer.js. That didn't work.

有没有人知道如何让 PDF.js 在 IE 9 上工作?我已经尝试了所有我能想到的方法来让它工作,但没有成功。我已经下载了 hack.js 文件并尝试在 pdf.js 之前和之后以及在 viewer.js 之前和之后添加它。那没有用。

I then tried downloading compatability.js, viewer.js and pdf.js from their Demo (Which I can confirm is working 100% in IE9) and put them into my HTML page, no go. I am using their PDF file, which some sites say that some PDFs work and others don't. So I figured if it worked on their site it must work on mine--but no go.

然后我尝试从他们的演示中下载 compatability.js、viewer.js 和 pdf.js(我可以确认它在 IE9 中 100% 工作)并将它们放入我的 HTML 页面中,不行。我正在使用他们的 PDF 文件,有些网站说有些 PDF 可以工作,有些则不能。所以我想如果它在他们的网站上工作,它必须在我的网站上工作——但不行。

The Demo of theirs works fine, but anytime I try to get mine to work in IE9, whether I use their files or my compiled version, it doesn't work.

他们的 Demo 工作正常,但任何时候我试图让我的 IE9 工作,无论我使用他们的文件还是我的编译版本,它都不起作用。

回答by Pavel G. Klukin

Try to load compatibility.js before pdf.js. Something like this:

尝试在 pdf.js 之前加载 compatible.js。像这样的东西:

  <script type="text/javascript" src="/js/compatibility.js"></script>
  <script type="text/javascript" src="/js/pdf_compr.js"></script>

回答by Ric

Browser support in their FAQs - check this as since the question was asked IE9 could have be supported: https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#what-browsers-are-supported

他们的常见问题解答中的浏览器支持 - 检查这一点,因为这个问题被问到 IE9 可以被支持:https: //github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#what-browsers-are-supported

回答by FlowPaper Team

PDF.JS and IE9 doesn't play too well together and I wouldn't rely on it if you want to support IE 9. Some of the rendering features in PDF.JS are not well progressed enough to be useable in IE9

PDF.JS 和 IE9 不能很好地配合使用,如果您想支持 IE 9,我不会依赖它。 PDF.JS 中的某些渲染功能进展不顺利,无法在 IE9 中使用

There are ways to get around this, you can use FlexPaper which can be used in combination with PDF.js and a HTML4 version for browsers without HTML5 support

有很多方法可以解决这个问题,您可以使用 FlexPaper,它可以与 PDF.js 和 HTML4 版本结合使用,用于不支持 HTML5 的浏览器

http://flexpaper.devaldi.com/demo/

http://flexpaper.devaldi.com/demo/

(note; I am affiliated with FlexPaper product)

(注意;我隶属于 FlexPaper 产品)