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

vue-pdf

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-pdf

vue.js pdf viewer

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
decreased by-10.4%
Maintainers
1
Weekly downloads
 
Created
Source

vue-pdf

vue.js pdf viewer

Install

npm install --save vue-pdf

Example

<template>
  <pdf src="./static/relativity.pdf" style="width:50%"></pdf>
</template>

<script>
import pdf from 'vue-pdf'

export default {
  components: {
    pdf
  }
}

Demo

vue-pdf demo on jsfiddle

API

props

:src String / Object - default: ''

The url of the pdf file. src may also be a string|TypedArray|DocumentInitParameters|PDFDataRangeTransport for more details, see PDFJS.getDocument().

:page Number - default: 1

The page number to display.

:rotate Number - default: 0

The page rotation in degrees, only multiple of 90 are valid.

:password Function(updatePassword, reason) - default: null
  • updatePassword: The function to call with the pdf password.
  • reason: the reason why this function is called 'NEED_PASSWORD' or 'INCORRECT_PASSWORD'

events

@progress Number

Document loading progress. Range [0, 1].

@loaded

Triggered when the document is loaded.

@pageLoaded Number

Triggered when a page is loaded.

@numPages Number

The total number of pages of the pdf.

@error Object

Triggered when an error occurred.

Public methods

print() EXPERIMENTAL

Prints the current page.

example
<template>
	<button @click="print">print</button>
	<pdf ref="myPdfComponent" src="https://cdn.mozilla.net/pdfjs/tracemonkey.pdf"></pdf>
</template>

<script>
	...
	methods: {
		print() {
			
			this.$refs.myPdfComponent.print();
		}
	}
	...
</script>

To do

  • Simplified non-webpack integration
  • Added more advanced examples
  • Add @progress event
  • Add :rotate prop
  • Handle PDF.js errors
  • Give access to the text content of the page
  • Make <resize-sensor> optional (implies adding a :scale prop)
  • Handle resize-sensor event throttle
  • Print the current page
  • Print the whold document
  • Buy more coffee

Credits

Franck Freiburger

Keywords

FAQs

Package last updated on 11 Apr 2017

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