27

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.

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.

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.

Zoltan Veres
  • 355
  • 5
  • 27
jfreak53
  • 2,239
  • 7
  • 37
  • 53
  • Do you have a link, or some sort of code showing how you're constructing things? – Stephen Sep 21 '12 at 20:40
  • It's on my localhost apache, so not really. Default construction, I Git copied the source, then `node make generic` and grabbed THEIR version under `build/web` and am using that. So I have not changed a single thing, their default node build is what I am using. – jfreak53 Sep 21 '12 at 20:52
  • Did you ever manage to get this working? I am seeing the same problem – colincameron Jan 21 '13 at 14:43
  • Nope, nothing at all, sometimes it works sometimes it doesn't. – jfreak53 Jan 21 '13 at 19:28
  • What happens when you change the standards mode or browser mode, after hitting F12 in IE9 - any luck? – klewis Jan 24 '13 at 20:22
  • Nothing, same deal. It doesn't really matter, I don't want to have to ask everyone client side to change to a different IE mode. That would loose people from viewing it. There has to be something code side that is up, or maybe it's the PDF I guess, but I haven't been able to prove that, every PDF I place there that isn't theirs does it. – jfreak53 Jan 25 '13 at 12:39
  • 3
    Hello - I have gotten this working, using the latest files from GitHub - could you post your code? To this working in IE I did have to remove all the console logging stuff (as IE still doesn't like this....) – Stuart.Sklinar Feb 20 '13 at 14:26
  • 9
    you dont have to remove them, just add a stubby log function to the console object – Less Mar 01 '13 at 13:38
  • 2
    could you please provide link for us to see what is it suppose to do? – happy Mar 14 '13 at 22:18
  • 2
    Problably you have an incompatible doctype, or js errors before running pdf.js. Try to use the same doctype as pdf.js demo page does. Also, make sure IE9 doesn't run in compatibility mode or quirks mode (it could be that your page has some serious HTML anomalies - does the W3C validator complain about anything?). – oxygen Mar 20 '13 at 19:53
  • 3
    Please Create a fiddle and post a link here so we can see the problem in your code. Or post your code directly by editing your post – MarmiK Apr 05 '13 at 13:25
  • Try using this hack on github: https://gist.github.com/notmasteryet/1057924 – vrume21 Apr 14 '13 at 14:06
  • Yes, I have gotten PDF.js to work under IE9 (but not less than that, as IE8 or less does not support canvas) I'm curious what errors you see with IE Web Developer when viewing a PDF-embedded page? Also, any server-side errors, such as permissions denied, when accessing the page? (FWIW, I switched from PDF.js to using Google Docs iframe solution. You're at their mercy, but it makes PDF embedding a trivial matter.) http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html – Screenack Apr 11 '13 at 18:01
  • Hello @jfreak53 can you please tell me how it's working for you I am having same problem – Yogesh Sharma Mar 04 '15 at 05:59
  • Check this article out for an alternative method to load PDF.JS https://developer.tizen.org/community/tip-tech/displaying-pdf-files-pdf.js-library – Alex Hendren Sep 03 '15 at 18:25

3 Answers3

9

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

  <script type="text/javascript" src="/js/compatibility.js"></script>
  <script type="text/javascript" src="/js/pdf_compr.js"></script>
tjati
  • 5,761
  • 4
  • 41
  • 56
  • Thanks! this fixed it for me, none of the other answers were helpful. Also as a note to others, i had already included a typed array polyfill, with this included as well as compatibility.js it failed. Also note compatibility.js is in vendor/mozilla/pdf.js/web/compatibility.js and its compatibility.js not compability.js – deweydb Nov 15 '14 at 02:51
1

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

Ric
  • 3,195
  • 1
  • 33
  • 51
  • 1
    That page really should mention that you need to include compatibility.js. – deweydb Nov 15 '14 at 19:45
  • Like it says: " If you want to support more browsers than Firefox you'll need to include compatibility.js which has polyfills for missing features. "? – async5 Jan 03 '15 at 15:00
-3

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

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

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

(note; I am affiliated with FlexPaper product)

FlowPaper Team
  • 500
  • 3
  • 7