Skip to content

How to use vue-pdf-embed with nuxt? #114

Answered by zguig52
hrynko asked this question in Q&A
Discussion options

You must be logged in to vote

Quick and easy steps for Nuxt3 integration as a plugin:

  1. Create a folder plugins

  2. Create a file named VuePdfEmbed.client.js inside the folder with following content:

import VuePdfEmbed from 'vue-pdf-embed'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(VuePdfEmbed)
  nuxtApp.vueApp.component('VuePdfEmbed', VuePdfEmbed);
})
  1. Use it in your app like this:
<ClientOnly>
  <VuePdfEmbed :source="pdfURL" />
</ClientOnly>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@flamerged
Comment options

Answer selected by hrynko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants