PDFJS in vue
-
How to use PDFJS in vue quasar framework?
-
I would like to use this function
https://github.com/mozilla/pdfjs-dist/blob/master/build/pdf.js#L939
-
Out of curiosity, can you explain your use case for the PDF viewer? I mean, I know it is to view PDFs, but how does that fit in with your use of Quasar?
Scott
-
Good answer given in Discord from Max Matteo :
check https://github.com/rossta/vue-pdfjs-demo
https://rossta.net/blog/building-a-pdf-viewer-with-vue-part-1.html
Scott
-
Sorry for my bad English.
I created a project with vue-cli to display pdf with this source: https://github.com/FranckFreiburger/vue-pdf
Everything works fine.
But when I created another project with quasar-cli and use the same code, it’s not working.
Screenshot here:
https://imgur.com/a/xHyKukj
Anyone can help me?
Thanks a lot. -
Well, without knowing any details about your implementation, I can say that your approach is incorrect. Your screenshot shows that you are trying to bring in webpack foo, but you cannot merely drop stuff into quasar that worked somewhere else, let alone that kind of stuff. We have a good introduction about how to do things “the quasar way” from the docs:
https://quasar-framework.org/guide/introduction-to-quasar.html
In particular you will want to look at integrating “plugins”.
https://quasar-framework.org/guide/app-plugins.html -
For anyone finding this thread trying to use PDFJS with your quasar app, see this comment/thread https://github.com/quasarframework/app-extension-qpdfviewer/issues/5#issuecomment-518041926
Also, don’t forget to import the webpack build from pdfjs-dist
const PDFJS = await import('pdfjs-dist/webpack')
-
At this point you could just use the app extension to view pdfs found here
-
So timely! I just saw this message. PDFJS has been integrated directly into QPdfviewer. You can pick which rendering engine you want to use.
https://forum.quasar-framework.org/topic/4244/quasar-qpdfviewer-v1-0-0-beta-4-release