Skip to content

Licensing

Authenticate Your License

A valid key and an approved domain are required to remove the watermark on Vue PDF Viewer from such sites.

Add a license key

After making a license purchase, you should receive a license key. You could also access the License Manager to retrieve your license key. Here is how you can add the license key in your project.

Vue 3

vue
<script setup lang="ts">
  import { VPdfViewer, useLicense } from '@vue-pdf-viewer/viewer';
  
  // If the value is empty or incorrect, the watermark will remain.
  const licenseKey = import.meta.env.VITE_VPV_LICENSE ?? 'your-VPV-license-key';
  useLicense({ licenseKey });
  
  const pdfFileSource = "https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf";
</script>
<template>
  <div :style="{ width: '1028px', height: '700px'}">
    <VPdfViewer :src="pdfFileSource" />
  </div>
</template>

Nuxt

When using Nuxt, you have the option to store the license key on the server-side:

.env

sh
NUXT_VPV_LICENSE_KEY=your-VPV-license-key

nuxt.config.ts / nuxt.config.js

ts
export default defineNuxtConfig({
  // ... 
  runtimeConfig: {
    vpvLicenseKey: ''
  }
})

server/api/vpv-license-key.ts

ts
export default defineEventHandler((event) => {
  const { vpvLicenseKey } = useRuntimeConfig(event)
  return {
    licenseKey: vpvLicenseKey
  }
})

components/AppPdfViewer.client.vue

vue
<script lang="ts" setup>
  import { VPdfViewer, useLicense, VPVBaseProps } from '@vue-pdf-viewer/viewer';

  const props = defineProps({ 
    ...VPVBaseProps, 
    title: String,
    licenseKey: { 
      type: String, 
      required: false 
    }
  })
  useLicense({ licenseKey: props.licenseKey });
</script>
<template>
  <div>
    <h2>
      {{ props.title }}
    </h2>
    <div :style="{ width: '1028px', height: '700px', margin: '0 auto' }">
      <VPdfViewer v-bind="$props" />
    </div>
  </div>
</template>

pages/index.vue

vue
<script setup lang="ts">
  // This will be requested on server-side
  const { data } = await useFetch<{ licenseKey: string }>('/api/vpv-license-key');
  // If the value is empty or incorrect, the watermark will remain.
  const licenseKey = computed(() => data.value?.licenseKey);
</script>
<template>
  <ClientOnly>
    <div :style="{ width: '1028px', height: '700px'}">
      <AppPdfViewer 
        src="https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf"
        title="Shared Component"
        :licenseKey="licenseKey"
      />
    </div>
  </ClientOnly>
</template>

Add an approved domain

An approved domain restricts license key usage to only specific domains you approved. To start adding an approved domain, please access the License Manager.

On the Approved Domain page, you can add as many domains as you like, including:

  • Localhost (e.g., localhost, localhost:3000) for local development
  • Domain names (e.g., example.com, www.example.com)
  • IP addresses (e.g., 192.168.1.1, 127.0.0.1:5173)

Important Notes

  • Domains are matched based on exact matches only. If you add example.com, only example.com will be approved. Subdomains like www.example.com or xyz.example.com will not work unless you add them separately.
  • Wildcard characters (*) are not supported at the moment. Each domain and subdomain need to be added individually.
  • Your license key will only function on these domains. Watermark in Vue PDF Viewer will still be visible on those domains that are not added.

An image of how to configure approved domain with Vue PDF Viewer

Remark: For more information on the licensing details