Getting Started
INFO
To try Vue PDF Viewer library for free, simply follow the instruction in the docs. For commercial use, please purchase a license or reach out to us at david@vue-pdf-viewer.dev.
Prerequisites
To run a Vue PDF Viewer component in a Vue.js application, here is the basic system requirement:
- Vue version: >= 3.0
If you are working with a Vue framework such as Nuxt, Quasar, Ionic and VitePress, Vue PDF Viewer can run smoothly as long as you are using Vue 3.
Vue PDF Viewer also works well with other Vue.js UI libraries such as PrimeVue, Vuetify and Element Plus.
Remark:
- Vite version will affect the Vue or Nuxt version used.
- If using TypeScript, it requires >= TypeScript 4.6.
Browser support
Vue PDF View component is supported only in modern browsers as follow:
Chrome | Firefox | Edge | Safari | Safari iOS | Chrome Android |
---|---|---|---|---|---|
115+ | 115+ | 115+ | 16.5+ | 16.5+ | 126+ |
Installation
Install Vue PDF Viewer
There are a few ways you can install Vue PDF Viewer, namely bun
, npm
, pnpm
or yarn
.
To install using bun
, run:
bun add @vue-pdf-viewer/viewer
Caching of previous Worker version with bun
To clear cache, try running bun pm cache rm
to remove cache in the global cache directory. If the error remains, try executing the following steps:
rm bun.lockb
rm -R node_modules
Please ensure that you follow this step if you want to override pdfjs-dist
version. After that, you may execute this command to install all dependencies again.
bun i
Installation issues
Apple M series
Since the default version of pdfjs-dist
in Vue PDF Viewer requires the canvas
package, you may need to manually add the canvas
package for Apple M1 and later chipsets.
You may use Brew
, a popular package manager to install the canvas dependencies:
$ brew install pkg-config cairo pango