New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pdf-viewer-vue

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdf-viewer-vue

PDF viewer component for Vue 2 and Vue 3

  • 0.2.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3K
decreased by-25.28%
Maintainers
1
Weekly downloads
 
Created
Source

📄 pdf-viewer-vue

PDF viewer component for Vue 2 and Vue 3

npm npm Github Repo stars npm

Compatibility

This package is compatible with both Vue 2 and Vue 3. The default exported build is for Vue 3, but dist directory also contains a build for Vue 2 (dist/vue2-pdf-viewer.js). See the example in Usage section.

Installation

Depending on the environment, the package can be installed in one of the following ways:


npm install pdf-viewer-vue


yarn add pdf-viewer-vue

<script src="https://unpkg.com/pdf-viewer-vue"></script>

Usage

<template>
  <div>
    <h1>File</h1>

    <PDFViewer
      :source="url"
      style="height: 100vh; width: 100vw"
      @download="handleDownload"
    />

    <h1>Base64</h1>

    <PDFViewer
      :source="base64"
      style="height: 100vh; width: 100vw"
      @download="handleDownload"
    />
  </div>
</template>

<script>
import PDFViewer from 'pdf-viewer-vue'

// OR THE FOLLOWING IMPORT FOR VUE 2
// import PDFViewer from 'pdf-viewer-vue/dist/vue2-pdf-viewer'

export default {
  components: {
    PDFViewer,
  },

  data() {
    return {
      url: '<PDF_URL>',
      base64: '<BASE64_ENCODED_PDF>',
    }
  },
}
</script>

Props

NameTypeAccepted valuesDescription
sourcestringdocument URL or Base64source of document
controlsstring[][
'download',
'print',
'rotate',
'zoom',
'catalog',
'switchPage',
]
visible controls
loading-textstring-loading text
rendering-textstring-rendering text
settings{ defaultZoom: number }-default settings

Events

NameValueDescription
download{source: string; filename: string;}pdf file base info
loaded{total: number}document load completed
loading-failedErrorfailed to load document
rendered-finished rendering the document
rendering-failedErrorfailed to render document

Examples

TODO: CodeSandbox or JSFiddle

License

MIT License. Please see LICENSE file for more information.

Keywords

FAQs

Package last updated on 27 Jan 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