question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
fcfortcommented, 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

0reactions
ehsaan-israrcommented, Jan 5, 2016

same case not working

PDFJS.getDocument(‘\pdfjs\files’);

Promise {[[PromiseStatus]]: “pending”, [[PromiseValue]]: undefined}

can anyone resolve this ???

Read more comments on GitHub >

github_iconTop Results From Across the Web

pdf.js not loading pdf file - Stack Overflow
Most of these problems are caused by the fact that you are running your test by opening an html file, thus the browser...
Read more >
JSDoc: Source: api.js
@property {boolean} [withCredentials] - Indicates whether or not; * cross-site Access-Control ... By default PDF.js attempts to load PDF files in chunks.
Read more >
vue-pdf - npm
onProgress: Callback return loading progress. withCredentials: Wheter or not to send cookies in the fetch request. Examples. Example - current ...
Read more >
Rendering PDF pages with PDF.js and Vue - rossta.net
I remember a time not too long ago when the possibility of rendering PDFs ... loading PDF.js to render an entire PDF document...
Read more >
Programmatic file downloads in the browser - LogRocket Blog
When the client (web browser in this case) receives this HTTP response, it simply displays or renders the GIF image — which is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found