Windows 10, Edge.
Some files are displayed very poorly
For example:
https://www.dropbox.com/s/6pxqjqsqaz19rl4/bad_pdf.pdf?dl=0
I don't see any obvious issues. Could you explain what's wrong? A screenshot that shows what you expect, and another one that shows what wrong would really help.
Just try to open attached file with your demo-viewer via Microsoft Edge (windows 10).
You will see a very long rendering (2-3 mins)
This PDF starts with a few thousands of useless instructions. If I disable web workers, the time-to-render seems to improve, possibly because the cost of copying the useless instructions from the worker thread to the main thread is gone.
To disable workers, set PDFJS.disableWorker = true;
, or enable debugging (https://github.com/mozilla/pdf.js/wiki/Debugging-PDF.js) and add #disableWorker=true
to the URL.
I was testing on Edge via Browserstack, but the developer tools are unfortunately non-functional, so I cannot debug this further.
Even a simple page of Tracemonkey can take up to 5 seconds to render in Edge. Since this was not the case with IE11, I can only assume that Edge contains a different renderer that has not been optimized very well. Unfortunately I do not have much time to debug this too.
Edge has a painfully slow native Promise implementation this has been fixed in the latest insider builds but that doesn't help anyone at the moment.
To fix speed issues I simply imported the bluebird polyfill to override the native Promise implementation and the rendering is a lot faster in Edge. pdf.js does have its own polyfill but it isnt used in this case because it assumes the browser provided one isn't going to be broken.
How can I override native Promise implementation ? I imported bluebird in viewer.js but seems that the native one is used instead.
I can confirm that pdf.js is a lot faster in the latest insider build of Edge. It has (roughly) the same speed as Chrome and Firefox has today. Bluebird will also speed up pdf.js in the current stable version of Edge.
@adineag: Take a look at this commit for an example of how you include bluebird: https://github.com/tjoskar/pdf.js/commit/0611343021d88ae954b7266e3dd0758e597a315a
Closing since we now use the streams API more often to avoid copying data (which Edge supports) and the Promise
implementation issue should be fixed upstream now.