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.

vue-pdf 4.0.6 library not work properly with vuejs version 2.

See original GitHub issue

I followed your examples and successfully run in local environment except production and development server. I’m not able to preview of pdf file on those servers.

I tried two ways to preview pdf files and as listed below. First, this.imageFileURL = URL.createObjectURL(imageFileObject) and second this.imageFileURL = pdf.createLoadingTask(URL.createObjectURL(imageFileObject)). here, imageFileObject variable provide file object from input method of javascript.

In addition, I would like to add how I imported library and register component. how I import is, import pdf from 'vue-pdf' then register component like, pdf: pdf,

  • Machine and library details:
    • vue-pdf 4.0.6
    • vue.js 2.3.3
    • webpack 2.6.1
    • browser chrome 70.0.3538.110
    • AWS EBS
    • Python 2.7 with Django 1.8

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
ghostcommented, Jul 30, 2019

Not sure if this would solve, but I encountered a similar problem elsewhere with web workers, which are used by the core layer of the underlying PDF.js library.

Assuming you’re using webpack, loading worker files requires:

  • installing worker-loader as a project dependancy
  • setting up a vue.config.js file in the root folder with the following code to make sure the loader bundles the worker files correctly:
module.exports = {
	configureWebpack: { 
		output: { 
			globalObject: 'this', 
		}, 
	},
}
1reaction
deepenpatel19commented, Apr 4, 2019

@jpbferreira Thanks for information.

I tried to find #.worker.js. but, no luck. I found something like var PdfjsWorker = require('worker-loader!pdfjs-dist/build/pdf.worker.js'); under vuePdfNoSss.vue and vuePdfSss.vue. Could you give me more information for how you managed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue-pdf doesn't refresh on src change - Stack Overflow
It works fine on the first run and the first file is loaded and displayed successfully. But once clicked on another file name...
Read more >
Vue.js - The Progressive JavaScript Framework | Vue.js
Vue.js - The Progressive JavaScript Framework. ... A rich, incrementally adoptable ecosystem that scales between a library and a full-featured framework.
Read more >
vue-pdf - npm
vue.js pdf viewer. Latest version: 4.3.0, last published: 2 years ago. Start using vue-pdf in your project by running `npm i vue-pdf`.
Read more >
vue-pdf vulnerabilities - Snyk
version published direct vulnerabilities 4.3.0 17 Jun, 2021 0. C. 0. H. 0. M. 0. L 4.2.0 14 Oct, 2020 0. C. 0. H. 0....
Read more >
Vue.js - Bountysource
Debugging in VS Code and Chrome not working with TypeScript $ 0 ... Created 4 years ago in vuejs/vue-cli with 24 comments. Version....
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