Vue 3 PDF Viewer

1.0.3 · active · verified Sun Apr 19

Vue3 Pdf App is a comprehensive Vue 3 component designed for displaying PDF documents within web applications. It is built upon Mozilla's robust PDF.js library, ensuring full compatibility with core PDF functionalities such as zooming, printing, downloading, rotation, text selection, and searching. The package is currently stable at version 1.0.3, actively maintained as a fork of `vue-pdf-app`, and appears to follow a regular release cadence given its recent updates. Key differentiators include its 100% PDF.js feature parity, easily localizable and highly configurable toolbar allowing for custom UI, extensive cross-browser support, and options for color customization, button icon themes, and light/dark modes. It also boasts built-in TypeScript support, providing a smooth development experience for type-safe applications. This component offers a robust, feature-rich solution for integrating PDF viewing directly into Vue 3 projects.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to embed a PDF viewer component, loading a sample PDF from a URL, and correctly applying necessary styling for rendering and toolbar icons.

<template>
  <!-- Important: The viewer component requires an explicit height to render correctly. -->
  <!-- You can set it directly or wrap it in a div with defined height. -->
  <div style="height: 100vh; width: 100%;">
    <VuePdfApp pdf="https://file-examples-com.github.io/uploads/2017/10/file-example_PDF_1MB.pdf"></VuePdfApp>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import VuePdfApp from "vue3-pdf-app";
// Import this to use default icons for toolbar buttons
import "vue3-pdf-app/dist/icons/main.css";

export default defineComponent({
  name: 'PdfViewer',
  components: {
    VuePdfApp
  }
});
</script>

<style>
body {
  margin: 0;
  padding: 0;
  overflow: hidden; /* Prevent body scroll if using 100vh/100vw */
}
</style>

view raw JSON →