0.1.2 • Published 2 years ago
lz-pdf-merage v0.1.2
lz-pdf-merage
lz-pdf-merage is a Vue component that can preview and synthesize PDF. Its main functions include stamping, adding date, adding text, rotating, printing, saving, etc.
Install
npm install lz-pdf-merage
Example
<template>
<pdfView :pdfPath='pdfPath' :pdfHeight="900" ref="pdfView"/>
</template>
<script>
import pdfView from 'lz-pdf-merage'
export default {
components:{
pdfView
},
data() {
return {
pdfPath: ''
}
}
}
</script>
Demo
Browser support
Same browser support as Vue.js 2
API
Props
:pdfPath String
The PDF path that needs to be previewed and synthesized supports local path and HTTP
:pdfHeight Number
Container width for preview and composite pdf
:pdfWidth Number
Container height for preview and composite pdf
Methods
addSeal(Object)
Add a stamp picture
pos
:Is the location random or determined when clicked, random is random, click is determined when clickedwidth
: stamp picture widthheight
: stamp picture heighturl
: stamp picture url SupportBase64
this.$refs.pdfView.addSeal({
pos: 'random' // 'click'
width: 200,
height: 200,
url: './seal.png'
})
addDate(Object)
Add Date
pos
: dittodate
: DatefontSize
: Date font sizeisTransParent
: Is it transparent
this.$refs.pdfView.addDate({
pos: 'click'
date: '2021 09 18',
fontSize: 24,
isTransParent: true
})
addText(Object)
Add Text
pos
: dittoisTransParent
: dittofontSize
: dittotext
: text
this.$refs.pdfView.addText({
pos: 'random'
isTransParent: false
fontSize: 24,
text: '样例展示'
})
deleteItem()
Delete selected item
this.$refs.pdfView.deleteItem()
downLoadPdf(name)
Download synthetic pdf
*name
: pdf name
this.$refs.pdfView.downLoadPdf('合成pdf')
License
MIT