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
Prerequisites
To run a Vue PDF Viewer component in a Vue.js application, here is the basic system requirement:
- Vue version: >= 3.0
- Package Bundler: Vite
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:
- If using TypeScript, Vue PDF Viewer requires >= TypeScript 4.6.
- Vite version will affect the Vue or Nuxt version used.
- Currently, the library does not support Webpack.
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/viewerCaching 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_modulesPlease 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 iLooking for a Faster Setup?
Here are repositories of various sample projects such as Vue for Options API, Composition API, Nuxt and Quasar for you to get started even faster.
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 pangoPeer Dependencies
Vue PDF Viewer requires PDF.js as a peer dependency with a default version of 4.10.38. You may override the default pdfjs-dist but using version 3.11.174 or below could affect the functionalities of Vue PDF Viewer.
For more information, refer to Overriding Dependency.