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

Error: Removed API method: PDFDocumentLoadingTask.then, use the promise getter instead. #230

Open
Davidbr17 opened this issue Jun 11, 2020 · 7 comments

Comments

@Davidbr17
Copy link

error with pdfjs-dist version

@lifecoderua
Copy link

Doesn't seem to be pdfjs-dist, it worked for me on 2.x before the latest updates.

Code also looks ok, it returns loadingTask.promise as expected for 2.x at
https://github.com/FranckFreiburger/vue-pdf/blob/master/src/pdfjsWrapper.js#L362

@FranckFreiburger
Copy link
Owner

@Davidbr17, can you provide us a stack trace ?

@Davidbr17
Copy link
Author

app.js?id=48141a9ecccaa7c1f0fa:110200
Error: Removed API method: PDFDocumentLoadingTask.then, use the promise getter instead.
at PDFDocumentLoadingTask.then (11.2acad0fb94df56ba92b0.js:11179)
at VueComponent.pdfRender (34.ad82936246c758c265ed.js:1046)
at VueComponent.handler (34.ad82936246c758c265ed.js:975)
at Watcher.run (app.js?id=48141a9ecccaa7c1f0fa:112870)
at flushSchedulerQueue (app.js?id=48141a9ecccaa7c1f0fa:112614)
at Array. (app.js?id=48141a9ecccaa7c1f0fa:110292)
at flushCallbacks (app.js?id=48141a9ecccaa7c1f0fa:110218)
logError @ app.js?id=48141a9ecccaa7c1f0fa:110200
globalHandleError @ app.js?id=48141a9ecccaa7c1f0fa:110191
handleError @ app.js?id=48141a9ecccaa7c1f0fa:110151
run @ app.js?id=48141a9ecccaa7c1f0fa:112872
flushSchedulerQueue @ app.js?id=48141a9ecccaa7c1f0fa:112614
(anonymous) @ app.js?id=48141a9ecccaa7c1f0fa:110292
flushCallbacks @ app.js?id=48141a9ecccaa7c1f0fa:110218
Promise.then (async)
timerFunc @ app.js?id=48141a9ecccaa7c1f0fa:110245
nextTick @ app.js?id=48141a9ecccaa7c1f0fa:110302
queueWatcher @ app.js?id=48141a9ecccaa7c1f0fa:112706
update @ app.js?id=48141a9ecccaa7c1f0fa:112846
notify @ app.js?id=48141a9ecccaa7c1f0fa:109048
reactiveSetter @ app.js?id=48141a9ecccaa7c1f0fa:109373
proxySetter @ app.js?id=48141a9ecccaa7c1f0fa:112933
click @ 34.ad82936246c758c265ed.js:1616
invokeWithErrorHandling @ app.js?id=48141a9ecccaa7c1f0fa:110166
invoker @ app.js?id=48141a9ecccaa7c1f0fa:110487
original._wrapper @ app.js?id=48141a9ecccaa7c1f0fa:115850

@blankmanp
Copy link

blankmanp commented Jun 12, 2020

When you use vuePdfNoSssNoWorker.vue or vuePdfNoSss.vue you will find this error. Because it requires pdfjs-dist/build/pdf.js which will throw the error.
My code is as below:

import pdf from 'vue-pdf/src/vuePdfNoSssNoWorker';
//....
pdf.createLoadingTask('file').then

If you want to fix this bug, you should try to use vue-pdf@4.0.8 and pdfjs-dist@2.3.200. In this way you will find this error as a warning. So please fix your package-lock.json or yarn.lock.

@lifecoderua
Copy link

@FranckFreiburger any updates on this issue?

@chris-aeviator
Copy link

chris-aeviator commented Jun 23, 2020

any updates on this issue? This is suddenly breaking a production site. Was successfully using vue-pdf as a nuxt plugin like so, but not anymore. The deprectation notice is coming from mozilla's pdf.js (mozilla/pdf.js#10377)

import Vue from 'vue'
import pdf from "vue-pdf";

Vue.component('pdf', pdf)
Vue.prototype.$pdfloadingTask = uri =>  pdf.createLoadingTask(uri)

@chris-aeviator
Copy link

chris-aeviator commented Jun 23, 2020

Seems like changing pdf.createLoadingTask(uri) to pdf.createLoadingTask(uri).promise solves the issue in my case. You will need to adjust your application logic most likely since it is now returning a promise.

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

No branches or pull requests

5 participants