@gabrielbu/vue-pdf-viewer
Vue PDF viewer components implemented using PDFJS.
Install
npm install --save @gabrielbu/vue-pdf-viewer
Usage in vue
<template>
<div id="app" style="height:100vh;width:100vw; position:fixed;">
<PDFView :src.sync="src" ref="pdfView" fileName="order" :scale.sync="scale">
<template slot="right-toolbox"></template>
<template slot="left-toolbox"></template>
<template slot="error"></template>
<template slot="loading"></template>
</PDFView>
</div>
</template>
<script>
import {PDFView} from '@gabrielbu/vue-pdf-viewer';
export default {
components:{
PDFView
},
data(){
return {
scale: "1.25"
}
}
}
</script>
API
Props
:src String / Object - default: null
src
accepts the following values:
for more details see PDFJS.getDocument()
.
:toolbarVisible Boolean - default: true
Toggle toolbar visibility.
:downloadFeatureVisible Boolean - default: true
Toggle download button feature visibility.
Toggle sidebar (page navigation bar) visibility.
:dropzoneFeatureVisible Boolean - default: true
Enable/disable the dropzone(drag-n-drop PDF files) feature.
:scale String - default: "1.25"
Set the initial scale of the viewer.
You can use it with :scale.sync
for enabling two-way data binding.
:fileName String - default: "{Date.now()}.pdf"
Name of the file used when download function is triggered.