Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@boooooob/vue3-pdfjs

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boooooob/vue3-pdfjs

PDF Reader for Vue 3 using Mozilla's PDF.js

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

vue supported version npm NPM

Forked from https://github.com/randolphtellis/vue3-pdfjs and enhanced a little.

Install

npm i @boooooob/vue3-pdfjs
or
yarn add @boooooob/vue3-pdfjs

Usage

Import globally

import { createApp } from 'vue'
import App from './App.vue'
import VuePdf from '@boooooob/vue3-pdfjs'

const app = createApp(App)
app.use(VuePdf)
app.mount('#app')

Props

export interface VuePdfPropsType {
  // The source of the pdf. Accepts the following types `string | URL | Uint8Array | PDFDataRangeTransport | DocumentInitParameters`
  src: string | URL | Uint8Array | PDFDataRangeTransport | DocumentInitParameters;
  // The page number of the pdf to display.
  page?: number;
  // Whether to display all pages. Ignore the prop `page` if true
  allPages?: boolean;
  // The scale (zoom) of the pdf. Setting this will also disable auto scaling and resizing. 
  scale?: number;
  // page wrapper id prefix, default is `vue-pdf-page`
  wrapperIdPrefix?: string;
}

Events


emit('progress', 0);
emit('pdfLoaded', pdf);
emit('totalPages', pdf.numPages);
emit('pageLoaded', page);

Basic Example

Import components from the esm folder to enable tree shaking. Please note that Mozilla's pdfjs npm package does not export tree-shakeable ES modules. Info here - https://github.com/mozilla/pdf.js/issues/12900

<script lang="ts">
import { defineComponent, ref } from 'vue';
import VuePdf from '@boooooob/vue3-pdfjs'

export default defineComponent({
  name: 'Home',
  components: { VuePdf },
  setup() {
    const pdfSrc = ref<VuePdfPropsType['src']>('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')

    return {
      pdfSrc
    }
  }
});
</script>

<template>
  <VuePdf :src="pdfSrc" all-pages />
</template>

Keywords

FAQs

Package last updated on 25 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc