Giter VIP home page Giter VIP logo

Comments (9)

FranckFreiburger avatar FranckFreiburger commented on June 12, 2024 1

I have to investigate the issue further. PDFJS.disableWorker = true should be considered as a workaround.

from vue-pdf.

ChenMachluf avatar ChenMachluf commented on June 12, 2024 1

That little fix solve the problem for me.
mozilla/pdf.js#8738
hope it will merge soon

If it not accepted there we can change this to the end of "loadDocument" in pdf.vue

loadingTask
.then(function(pdf) {
	pdfDoc = pdf;
	emitEvent('numPages', pdf.numPages);
	emitEvent('loaded');
})
.catch(function(err) {
	clearCanvas();
	clearAnnotations();
	emitEvent('error', err);
})
.then(function(){
	loadingTask._worker = null;
})

from vue-pdf.

FranckFreiburger avatar FranckFreiburger commented on June 12, 2024 1

@ChenMachluf thanks for your fix !
Since several people are waiting for this fix, I commit your 2nd proposition while mozilla/pdf.js#8738 is pending.

from vue-pdf.

philefstat avatar philefstat commented on June 12, 2024

Solved by setting
PDFJS.disableWorker = true

from vue-pdf.

philefstat avatar philefstat commented on June 12, 2024

@FranckFreiburger one alternative might be to explicitly set the worker in the created hook.

Something like PDFJS.workerSrc = 'pdfjs/build/pdf.worker.js'

from vue-pdf.

Say-healer avatar Say-healer commented on June 12, 2024

Where would the PDFJS.disableWorker = true go into effect?

from vue-pdf.

guguzhy avatar guguzhy commented on June 12, 2024

where set the PDFJS.disableWorker = true , i tried in the created () lift-time ,i see the PDFJS.disableWorker is
true ,but the error still exist

from vue-pdf.

jdemoort avatar jdemoort commented on June 12, 2024

Hi,
Tried both PDFJS.disableWorker=true and setting PDFJS.workerSrc without success.
Any other suggestions?

Thanks!

from vue-pdf.

alexandregodet avatar alexandregodet commented on June 12, 2024

Hi, same problem here.
The only solution that worked for me was to set the doc src to null value just after calling the print() method.

Html:
<pdf ref="invoice" :src="pdf_src"></pdf>

JS:
this.$refs.invoice.print()
setTimeout(() => { this.pdf_src = null }, 500)

By doing that, the destroy method will never be called (https://github.com/FranckFreiburger/vue-pdf/blob/master/src/pdf.vue#L178)

It's just a workaround

from vue-pdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.