【问题标题】:PDF.js not working on IE 11PDF.js 不适用于 IE 11
【发布时间】:2018-04-21 23:35:16
【问题描述】:

我已经找了好几天了,但我仍然无法让 PDF.js 在 IE11 上工作,无论 IE11 是否被列为 supported browser,如 PDF.js DEMO 所示。

Chrome 的控制台中未显示任何错误。但是IE11的Console有3个错误:

Chrome's Console

IE10's Console

谁能提供一些帮助?谢谢

【问题讨论】:

  • Promise在IE11中不支持,需要添加polyfill

标签: javascript pdf internet-explorer-11 pdf.js


【解决方案1】:

IE11 不支持 ES6 格式,因此 PDF.js 的某些功能在 IE11 中无法使用。

您可以尝试使用 ES5 版本的 pdf.js 和 pdf.worker.js。

任一:

  1. import "pdfjs-dist/build/pdf.js"import "pdfjs-dist/es5/build/pdf.js"时间>
  2. import "pdfjs-dist/build/pdf.worker.js" 到 => import "pdfjs-dist/es5/build/pdf.worker.js"

或使用 ES5 版本:

  1. pdf.jshttps://mozilla.github.io/pdf.js/es5/build/pdf.js
  2. pdf.worker.jshttps://mozilla.github.io/pdf.js/es5/build/pdf.worker.js

【讨论】:

    【解决方案2】:

    可能是因为 IE11 不支持 ES6。 Support for ES6 in Internet Explorer 11

    我希望这对将来的某人有所帮助。

    【讨论】:

      猜你喜欢
      • 2018-10-21
      • 1970-01-01
      • 2016-09-15
      • 1970-01-01
      • 2014-07-07
      • 2017-05-05
      • 1970-01-01
      • 2013-06-06
      • 2012-09-14
      相关资源
      最近更新 更多