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.
To do
Credits
Franck Freiburger