Skip to content

Slots

VPV provides slots for customizing all tools in the toolbar, allowing you to override the default UI elements. Each tool has a slot with a prefix icon, making it easy to change any icons in the toolbar.

Slots - Icons

NameDescription
iconThumbnailTo change the thumbnail icon
iconSearchTo change the search icon
iconPrevPageTo change the previous page icon
iconNextPageTo change the next page icon
iconZoomOutTo change the zoom-out icon
iconZoomInTo change the zoom-in icon
iconThemeDarkTo change the dark mode icon when the current state is light
iconThemeLightTo change the light mode icon when the current state is dark
iconOpenFileTo change the open local file icon
iconDownloadTo change the download icon
iconPrintTo change the print icon
iconFullScreenTo change the full screen icon
iconMoreOptionsTo change the more option menu icon
iconFirstPageTo change the first page icon
iconLastPageTo change the last page icon
iconRotateClockwiseTo change the rotate clockwise icon
iconRotateCounterClockwiseTo change the rotate counterclockwise icon
iconTextSelectionTo change the text selection mode icon
iconHandModeTo change the hand mode icon
iconScrollingPageTo change the page scrolling icon
iconScrollingVerticalTo change the vertical scrolling icon
iconScrollingHorizontalTo change the horizontal scrolling icon
iconScrollingWrappedTo change the wrapped scrolling icon
iconPageViewSingleTo change the single page view icon
iconPageViewDualTo change the dual page view icon
iconDocPropertiesTo change the document properties icon

Example

vue
<script setup lang="ts">
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
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">
      <template #iconPrint>
        <span>P</span>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
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">
      <template #iconPrint>
        <span>P</span>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #iconPrint>
        <span>P</span>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #iconPrint>
        <span>P</span>
      </template>
    </VPdfViewer>
  </div>
</template>

Slots - Tools

NameDescription
dropFileZoneTo change the style of the drop file zone
downloadToolTo override the icon or download flow
fullScreenToolTo override the icon or full screen flow
loaderTo replace the default loader
loaderImageTo replace the default loader image
loaderProgressTo show or adjust the progress percentage which is below the loader image
openFileToolTo override the icon or open file flow
pageNavigationToolTo customize the display of the navigation UI
printToolTo override the icon or print flow
thumbnailToolTo override the icon or thumbnail flow
themeToolTo change the light and dark icons
zoomToolTo customize the display of the zoom UI

dropFileZone

Example

vue
<script setup lang="ts">
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
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">
      <template #dropFileZone> Drop file here </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
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">
      <template #dropFileZone> Drop file here </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #dropFileZone> Drop file here </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #dropFileZone> Drop file here </template>
    </VPdfViewer>
  </div>
</template>

downloadTool

PropDescriptionType
onClickDownload file function handler() => void

Example

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

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">
      <template #downloadTool="{ onClick }">
        <button @click="onClick">download</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

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">
      <template #downloadTool="{ onClick }">
        <button @click="onClick">download</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #downloadTool="{ onClick }">
        <button @click="onClick">download</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #downloadTool="{ onClick }">
        <button @click="onClick">download</button>
      </template>
    </VPdfViewer>
  </div>
</template>

fullScreenTool

PropDescriptionType
isSupportedIndicate whether the browser's full screen mode is supportedboolean
onClickFull screen function handler() => void

Example

vue
<script setup lang="ts">
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
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">
      <template #fullScreenTool="{ onClick, isSupported }">
        <button @click="onClick" :disabled="!isSupported">full screen</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
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">
      <template #fullScreenTool="{ onClick, isSupported }">
        <button @click="onClick" :disabled="!isSupported">full screen</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #fullScreenTool="{ onClick, isSupported }">
        <button @click="onClick" :disabled="!isSupported">full screen</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #fullScreenTool="{ onClick, isSupported }">
        <button @click="onClick" :disabled="!isSupported">full screen</button>
      </template>
    </VPdfViewer>
  </div>
</template>

loader

PropDescriptionType
progressState of loading progress in percentagenumber
loadedReturn true when the PDF has finished loadingboolean

Example

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

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">
      <template #loader="{ progress, loaded }">
        <div v-if="!loaded" class="loader-wrapper">
          <img src="/your-loader.gif" />
        </div>
      </template>
    </VPdfViewer>
  </div>
</template>
<style scoped>
.loader-wrapper {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgb(251 191 36 / 0.75);
}
</style>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

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">
      <template #loader="{ progress, loaded }">
        <div v-if="!loaded" class="loader-wrapper">
          <img src="/your-loader.gif" />
        </div>
      </template>
    </VPdfViewer>
  </div>
</template>
<style scoped>
.loader-wrapper {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgb(251 191 36 / 0.75);
}
</style>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #loader="{ progress, loaded }">
        <div v-if="!loaded" class="loader-wrapper">
          <img src="/your-loader.gif" />
        </div>
      </template>
    </VPdfViewer>
  </div>
</template>
<style scoped>
.loader-wrapper {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgb(251 191 36 / 0.75);
}
</style>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #loader="{ progress, loaded }">
        <div v-if="!loaded" class="loader-wrapper">
          <img src="/your-loader.gif" />
        </div>
      </template>
    </VPdfViewer>
  </div>
</template>
<style scoped>
.loader-wrapper {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgb(251 191 36 / 0.75);
}
</style>

loaderImage

Example

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

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">
      <template #loaderImage>
        <img src="/your-spin-image.png" width="80" height="80" />
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

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">
      <template #loaderImage>
        <img src="/your-spin-image.png" width="80" height="80" />
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #loaderImage>
        <img src="/your-spin-image.png" width="80" height="80" />
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #loaderImage>
        <img src="/your-spin-image.png" width="80" height="80" />
      </template>
    </VPdfViewer>
  </div>
</template>

loaderProgress

PropDescriptionType
progressState of loading progress in percentagenumber

Example

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

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">
      <template #loaderProgress="{ progress }">
        <p class="m-0">
          <strong>{{ progress }}</strong>
        </p>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

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">
      <template #loaderProgress="{ progress }">
        <p class="m-0">
          <strong>{{ progress }}</strong>
        </p>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #loaderProgress="{ progress }">
        <p class="m-0">
          <strong>{{ progress }}</strong>
        </p>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #loaderProgress="{ progress }">
        <p class="m-0">
          <strong>{{ progress }}</strong>
        </p>
      </template>
    </VPdfViewer>
  </div>
</template>

openFileTool

PropDescriptionType
onClickOpen file function handler() => void

Example

vue
<script setup lang="ts">
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
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">
      <template #openFileTool="{ onClick }">
        <button @click="onClick">open local file</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";
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">
      <template #openFileTool="{ onClick }">
        <button @click="onClick">open local file</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #openFileTool="{ onClick }">
        <button @click="onClick">open local file</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #openFileTool="{ onClick }">
        <button @click="onClick">open local file</button>
      </template>
    </VPdfViewer>
  </div>
</template>
PropDescriptionType
totalTotal page count of the PDF documentnumber
currentCurrent page numbernumber
onNextNext page function handler() => void
onPrevPrevious page function handler() => void
onChangePagePage change function handler(page: number) => void

Example

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

const pdfFileSource =
  "https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf";
const handlePageEntered = (
  e: Event,
  changePage: (pageNumber: number) => void,
) => {
  const value = (e.target as HTMLInputElement).value;
  changePage(+value);
};
</script>
<template>
  <div :style="{ width: '1028px', height: '700px' }">
    <VPdfViewer :src="pdfFileSource">
      <template
        #pageNavigationTool="{ total, current, onNext, onPrev, onChangePage }"
      >
        <input
          :value="current"
          @keyup.enter="handlePageEntered($event, onChangePage)"
        />/{{ total }}
        <button @click="onPrev">Previous</button>
        <button @click="onNext">Next</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

const pdfFileSource =
  "https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf";
const handlePageEntered = (e, changePage) => {
  const value = e.target.value;
  changePage(+value);
};
</script>
<template>
  <div :style="{ width: '1028px', height: '700px' }">
    <VPdfViewer :src="pdfFileSource">
      <template
        #pageNavigationTool="{ total, current, onNext, onPrev, onChangePage }"
      >
        <input
          :value="current"
          @keyup.enter="handlePageEntered($event, onChangePage)"
        />/{{ total }}
        <button @click="onPrev">Previous</button>
        <button @click="onNext">Next</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      pdfFileSource:
        "https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf",
    };
  },
  methods: {
    handlePageEntered(e, changePage) {
      const value = e.target.value;
      changePage(+value);
    },
  },
});
</script>
<template>
  <div :style="{ width: '1028px', height: '700px' }">
    <VPdfViewer :src="pdfFileSource">
      <template
        #pageNavigationTool="{ total, current, onNext, onPrev, onChangePage }"
      >
        <input
          :value="current"
          @keyup.enter="handlePageEntered($event, onChangePage)"
        />/{{ total }}
        <button @click="onPrev">Previous</button>
        <button @click="onNext">Next</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      pdfFileSource:
        "https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf",
    };
  },
  methods: {
    handlePageEntered(e, changePage) {
      const value = e.target.value;
      changePage(+value);
    },
  },
};
</script>
<template>
  <div :style="{ width: '1028px', height: '700px' }">
    <VPdfViewer :src="pdfFileSource">
      <template
        #pageNavigationTool="{ total, current, onNext, onPrev, onChangePage }"
      >
        <input
          :value="current"
          @keyup.enter="handlePageEntered($event, onChangePage)"
        />/{{ total }}
        <button @click="onPrev">Previous</button>
        <button @click="onNext">Next</button>
      </template>
    </VPdfViewer>
  </div>
</template>

printTool

PropDescriptionType
onClickPrint PDF function handler() => void
vue
<script setup lang="ts">
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

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">
      <template #printTool="{ onClick }">
        <button @click="onClick">Print</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

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">
      <template #printTool="{ onClick }">
        <button @click="onClick">Print</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #printTool="{ onClick }">
        <button @click="onClick">Print</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #printTool="{ onClick }">
        <button @click="onClick">Print</button>
      </template>
    </VPdfViewer>
  </div>
</template>

themeTool

PropDescriptionType
isDarkState of the browser preference modeboolean
onClickFunction to switch the VPV's appearenceboolean

Example

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

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">
      <template #themeTool="{ isDark, onClick }">
        <button @click="onClick">
          <span v-if="isDark">Day</span>
          <span v-else>Night</span>
        </button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

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">
      <template #themeTool="{ isDark, onClick }">
        <button @click="onClick">
          <span v-if="isDark">Day</span>
          <span v-else>Night</span>
        </button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #themeTool="{ isDark, onClick }">
        <button @click="onClick">
          <span v-if="isDark">Day</span>
          <span v-else>Night</span>
        </button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #themeTool="{ isDark, onClick }">
        <button @click="onClick">
          <span v-if="isDark">Day</span>
          <span v-else>Night</span>
        </button>
      </template>
    </VPdfViewer>
  </div>
</template>

thumbnailTool

PropDescriptionType
onToggleFunction to toggle the visibility of the thumbnail sidebar() => void

Example

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

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">
      <template #thumbnailTool="{ onToggle }">
        <button @click="onToggle">T</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

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">
      <template #thumbnailTool="{ onToggle }">
        <button @click="onToggle">T</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #thumbnailTool="{ onToggle }">
        <button @click="onToggle">T</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #thumbnailTool="{ onToggle }">
        <button @click="onToggle">T</button>
      </template>
    </VPdfViewer>
  </div>
</template>

zoomTool

PropDescriptionType
currentScaleCurrent scale of the Vue PDF Viewernumber
zoomZoom function(nextScale: number) => void

Example

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

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">
      <template #zoomTool="{ currentScale, zoom }">
        <button @click="zoom(currentScale - 2)">ZoomOut</button>
        <strong>{{ currentScale }}</strong>
        <button @click="zoom(currentScale + 5)">ZoomIn</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script setup>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

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">
      <template #zoomTool="{ currentScale, zoom }">
        <button @click="zoom(currentScale - 2)">ZoomOut</button>
        <strong>{{ currentScale }}</strong>
        <button @click="zoom(currentScale + 5)">ZoomIn</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script lang="ts">
import { defineComponent } from "vue";
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default defineComponent({
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #zoomTool="{ currentScale, zoom }">
        <button @click="zoom(currentScale - 2)">ZoomOut</button>
        <strong>{{ currentScale }}</strong>
        <button @click="zoom(currentScale + 5)">ZoomIn</button>
      </template>
    </VPdfViewer>
  </div>
</template>
vue
<script>
import { VPdfViewer } from "@vue-pdf-viewer/viewer";

export default {
  components: { VPdfViewer },
  data() {
    return {
      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">
      <template #zoomTool="{ currentScale, zoom }">
        <button @click="zoom(currentScale - 2)">ZoomOut</button>
        <strong>{{ currentScale }}</strong>
        <button @click="zoom(currentScale + 5)">ZoomIn</button>
      </template>
    </VPdfViewer>
  </div>
</template>