Skip to content

Plugin ​

Installing the plugin registers <PdfViewer> globally and sets app-wide defaults. It is optional – the component works with a plain import too.

ts
import { createApp } from 'vue'
import VuePdfz from 'vue-pdfz'
import 'vue-pdfz/style.css'
import App from './App.vue'

createApp(App)
  .use(VuePdfz, {
    theme: 'dark',
    locale: 'es',
    messages: { es: { download: 'Exportar' } },
  })
  .mount('#app')

Options ​

The options object has type VuePdfzPluginOptions (exported from vue-pdfz).

OptionTypeDefaultDescription
i18nAdapterI18nAdapter–Host i18n adapter (e.g. a vue-i18n bridge).
localestring'en'Default locale code for all viewers.
messagesLocaleMessagesMap–Global message overrides, keyed by locale.
registerComponentsbooleantrueRegister the component globally as <PdfViewer>.
shortcutsKeyboardShortcuts–Default keyboard-shortcut overrides.
themeTokensThemeTokens–Global design-token overrides for all viewers.
themeThemeMode–Default theme mode for all viewers.

Per-viewer props always override the plugin defaults; per-viewer messages and themeTokens merge over the plugin-wide ones.

Named export ​

The default export and the named VuePdfz export are the same plugin:

ts
import VuePdfz from 'vue-pdfz'
// or
import { VuePdfz } from 'vue-pdfz'