how to print in vue js use vue-html-to-paper
npm install vue-html-to-paper
import Vue from 'vue';
import VueHtmlToPaper from 'vue-html-to-paper';
const options = {
name: '_blank',
specs: [
'fullscreen=yes',
'titlebar=yes',
'scrollbars=yes'
],
styles: [
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',
'https://unpkg.com/kidlat-css/css/kidlat.css'
]
}
Vue.use(VueHtmlToPaper, options);
Vue.use(VueHtmlToPaper);
component:
<template>
<div>
<div id="printMe">
<h1>Print me!</h1>
</div>
<button @click="print"></button>
</div>
<template>
<script>
export default {
data () {
return {
output: null
}
},
methods: {
print () {
this.$htmlToPaper('printMe');
}
}
}
</script>