1.9.6 • Published 1 month ago

@tato30/vue-pdf v1.9.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Introduction

VuePDF is a Vue 3 component for pdf.js that allows you to flexibly display PDF pages within your project.

Installation

npm i @tato30/vue-pdf
yarn add @tato30/vue-pdf

Basic Usage

<script setup>
import { VuePDF, usePDF } from '@tato30/vue-pdf'

const { pdf, pages, info } = usePDF('document.pdf')

console.log(`Document has ${pages} pages`)
console.log(`Document info: ${info}`)
</script>

<template>
  <VuePDF :pdf="pdf" />
</template>

Reference

Working With Layers

Text and Annotations

This component supports text-selection and annotation-interaction by enabling them with text-layer and annotation-layer props respectively, but for this layers renders correctly is necessary setting css styles, it can be done by importing default styles from @tato30/vue-pdf/style.css.

<script setup>
import { VuePDF, usePDF } from '@tato30/vue-pdf'
import '@tato30/vue-pdf/style.css'

const { pdf } = usePDF('sample.pdf')
</script>

<template>
  <VuePDF :pdf="pdf" text-layer annotation-layer />
</template>

You can also create your own custom styles and set them in your project, use this examples as guide:

XFA Forms

XFA forms also can be supported by enabling them from usePDF.

<script setup>
import { VuePDF, usePDF } from '@tato30/vue-pdf'
import '@tato30/vue-pdf/style.css'

const { pdf } = usePDF({
  url: '/example_xfa.pdf',
  enableXfa: true,
})
</script>

<template>
  <VuePDF :pdf="pdf" />
</template>

Server-Side Rendering

VuePDF is a client-side library, so if you are working with SSR frameworks like nuxt, surely will throw error during building stage, if that the case, you could wrap library in some "client only" directive or component, also usePDF should be wrapped.

Contributing

Any idea, suggestion or contribution to the code or documentation are very welcome.

# Clone the repository
git clone https://github.com/TaTo30/VuePDF.git

# Change to code folder
cd VuePDF

# Install node_modules
npm install

# Run code with hot reload
npm run dev
1.9.6

1 month ago

1.9.5

2 months ago

1.9.4

4 months ago

1.9.3

4 months ago

1.9.2

4 months ago

1.9.1

4 months ago

1.9.0

5 months ago

1.7.3

8 months ago

1.8.1

6 months ago

1.7.2

9 months ago

1.8.0

6 months ago

1.7.1

9 months ago

1.6.2

10 months ago

1.7.0

10 months ago

1.6.1

10 months ago

1.5.2

10 months ago

1.7.4

8 months ago

1.6.0

11 months ago

1.4.6

11 months ago

1.4.5

11 months ago

1.4.4

11 months ago

1.4.3

11 months ago

1.5.1

11 months ago

1.5.0

11 months ago

1.4.8

11 months ago

1.4.7

11 months ago

1.4.2

11 months ago

1.4.1

11 months ago

1.3.5

12 months ago

1.4.0

12 months ago

1.3.5-beta.0

12 months ago

1.4.0-beta.10

12 months ago

1.4.0-beta.3

12 months ago

1.4.0-beta.2

12 months ago

1.4.0-beta.1

12 months ago

1.4.0-beta.0

12 months ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.4

1 year ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.0-beta.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago