Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDFJS.getDocument().then is not working, not file is loaded no callbacks are triggered, not errors in console. #5344

Closed
j-mcnally opened this issue Sep 26, 2014 · 5 comments

Comments

@j-mcnally
Copy link

To reproduce:

PDFJS.getDocument("/pdf.pdf").then(function() { alert("yo") })

Console returns

Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}

Alert never happens, no xhr calls are fired.

Version info: 1.0.233, build d39af0a

@yurydelendik
Copy link
Contributor

@yurydelendik
Copy link
Contributor

Also with STR:

  1. Open http://mozilla.github.io/pdf.js/examples/learning/helloworld.html in the Firefox or Chrome.
  2. Open JavaScript console and type PDFJS.getDocument("./helloworld.pdf").then(function() { alert("yo") })
  3. notice 'yo'

@j-mcnally
Copy link
Author

Updating to latest PDF.js fixed the issue.

@ehsaan-israr
Copy link

same case not working

PDFJS.getDocument('\pdfjs\files');

Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}

can anyone resolve this ???

@fcfort
Copy link

fcfort commented Feb 20, 2016

I had this same issue when trying to use PDFJS inside a Chrome extension content script. Chrome extensions content scripts disallow the use of document.currentScript which PDFJS relies upon in order to load the pdf.worker.js script. Instead I manually edited pdf.js to reference a chrome extension URL via the Chrome extension API call:

PDFJS.workerSrc = chrome.extension.getURL("libs/pdf.worker.js");

Where libs/pdf.worker.js was the relative location inside my Chrome extension.

Not sure if that helps but I found this issue page from googling for my issue.

See my copy of pdf.js here https://github.com/fcfort/betterment-csv-chrome/blob/master/libs/pdf.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants