Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vue-pdf-kit

fumtydt80MIT0.0.7TypeScript support: included

A high-definition PDF preview component that supports both Vue 2 and Vue 3.

pdf, vue, pdfjs, vue3-pdf, vue3, vue2-pdf, vue2, vue-pdf

readme

vue-pdf-kit

A high-definition PDF viewer component for Vue 2 & Vue 3.

npm Version npm Downloads License

Features

  • Ensures high-definition rendering of PDFs.
  • Renders PDF documents in Vue applications, with support for both Vue 2 and Vue 3.
  • Enables text selection and search within the rendered PDF documents.
  • Supports rendering annotations within PDF.

Installation & Usage

npm install vue-pdf-kit
yarn add vue-pdf-kit

Usage

<script setup>
import VuePdfKit from 'vue-pdf-kit'
import 'vue-pdf-kit/dist/style.css'
</script>

<template>
  <VuePdfKit source="<url> | <base64>" enableTextLayer enableAnnotation />
</template>

If you want to use the component in Vue 2.6, you will install it as follows:

npm i @vue/composition-api

Props

Name Type Accepted values Description
source string
`object
URL or Base64 Source of the document to display
scale number numbers The ratio of canvas size to document size
enableTextLayer boolean true or false whether the text layer should be enabled
enableAnnotation boolean true or false Whether annotations should be enabled
password string Any string Password for encrypted documents, if required
enableCMap boolean true or false Enables Character Maps for accurate text rendering

Events

Name Value Description
progress 0-1 number Represents the current progress or completion ratio of a task or operation, expressed as a percentage.
password {callback:()=>{}} Contains properties related to password handling.

License

MIT License. Please see LICENSE file for more information.

changelog

0.0.6 (2024-08-03)

Bug Fixes

  • :bug: fix the issue that PDF cannot be displayed in lower version browsers (7e049a7)

0.0.5 (2024-07-26)

Bug Fixes

  • :bug: fixing Inability to Display PDF as Base64 (fae73ba)

0.0.4 (2024-07-07)

Bug Fixes

  • :bug: fixed type import issues (de42c95)

Features

  • :sparkles: add cMapUrl attr (00807aa)

0.0.3 (2024-03-21)

Features

  • :sparkles: add progress and password events (8920a62)

0.0.1 (2024-03-19)

Bug Fixes

  • :bug: pdf viwer doesn't show up in vue2 (3a2a4e2)