Open kmcallister opened 9 years ago
Using the current trunk, the console outputted the following when I clicked on "Demo":
$ ./mach run https://mozilla.github.io/pdf.js/
ERROR:net_traits::image::base: stb_image failed: stbi_load_from_memory failed
PDF 110dd61fd57444010b1ab5ff38782f0f [1.4 pdfeTeX-1.21a / TeX] (PDF.js: 1.1.147)
Warning: Unhandled rejection: TypeError: window.history is undefined
pdfHistoryInitialize@https://mozilla.github.io/pdf.js/web/viewer.js:1466
pdfViewLoad/<@https://mozilla.github.io/pdf.js/web/viewer.js:6372
runHandlers@https://mozilla.github.io/pdf.js/build/pdf.js:1159
Here's the screenshot of what I have:
Yeah that's how it looks here as well. I didn't get the console output though (maybe I have it disabled somehow).
You can try my piston-image branch, although it too fails on many images.
Current status: pdf.js assumes window.history exists. If you hack past that, there aren't any errors, the UI renders, and the progress bar works, but it never actually shows the rendered page.
You don't have to block this by window.history
or localStorage
API -- those are not essential APIs for PDF.js library. The viewer for Servo might look different or not use the same DOM APIs.
The main part of the library is canvas support specifically context 2d. See ctx.xxxx
function usages in the https://github.com/mozilla/pdf.js/blob/master/src/display/canvas.js. (And probably @font-face usage with canvas).
Please find more simplified viewer at http://mozilla.github.io/pdf.js/examples/learning/prevnext.html
See also #8917
I tried testing this out and loading https://mozilla.github.io/pdf.js/web/viewer.html resulted in an error message in Servo.
https://mozilla.github.io/pdf.js/es5/web/viewer.html loaded however no content in the PDF was visible.
The first error I get is about missing AbortController, we have PR landed, but sadly it got reverted due to flakiness: https://github.com/servo/servo/pull/31361, but even if I use that PR PDF is note rendered (see last image of previous comment), up-to-date link for legacy pdf.js: https://mozilla.github.io/pdf.js/legacy/web/viewer.html. https://mozilla.github.io/pdf.js/examples/ gives this error:
pdf.mjs:11002:32 Promise.withResolvers is not a function
EDIT: This error happens because examples do not use legacy viewer, this will come in next SM upgrade.
I will try to get the list what we are missing for it to work apart from the two known ones.
@sagudev Any update on what else might be blocking this (aside from AbortController support)?
Not really, as I got sidetracked so you can pick it up.
https://mozilla.github.io/pdf.js/