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
Starting from @vue-pdf-viewer/viewer@^4.0.0, we officially support PDF.js 5 and default to PDF.js 5.4.530.
As newer PDF.js versions rely on more modern browser APIs, minimum supported browser versions have changed. Please review the compatibility details below before choosing a PDF.js version.
Default (PDF.js 5.4.530)
Vue PDF Viewer v4.0.0 defaults to PDF.js 5.4.530.
| Chrome | Firefox | Edge | Safari | Safari iOS | Chrome Android |
|---|---|---|---|---|---|
| 126+ | 126+ | 126+ | 18.4+ | 18.4+ | 126+ |
TIP
It's currently not recommended to use a PDF.js worker version beyond 5.4.530 because it will support fewer browser versions.
Using PDF.js 4.10.38
If you need broader browser compatibility, you can continue using PDF.js 4.10.38, which supports:
| Chrome | Firefox | Edge | Safari | Safari iOS | Chrome Android |
|---|---|---|---|---|---|
| 119+ | 115+ | 115+ | 17.4+ | 17.4+ | 126+ |
To change the version of PDF.js used, refer to the Overriding Dependency guide.
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 (pdfjs-dist) as a peer dependency with a default version of 5.4.530.
You may override the default pdfjs-dist (for example, to 4.10.38 for broader browser support). Using version 4.10.38 or below could affect the functionality of Vue PDF Viewer.
For more information, refer to Overriding Dependency.
Bundler compatibility
pdfjs-dist v5 is ESM-only. Most modern bundlers handle this without extra configuration:
- Vite — works out of the box
- Nuxt 3 (Vite) — works out of the box