I have installed printJS
on my vue project using npm install print-js --save
Print Preview is now successfully displaying but the problem is that it is printing the whole page together with the side panel and the scroll bars. I have implemented it like this:
<template>
<b-modal>
<div id="print-form">
<table style="border-collapse: collapse; width: 100%" border="1px">
</table>
<button onclick="print()" class="btn btn-primary btn-block">Print</button>
</div>
</b-modal>
</template>
import * as Printjs from "print-js";
export default {
method: {
print() {
Printjs({
printable: "print-registration-form", //Id to print content
type: "HTML"
});
}
}
}
When I click print, it will print the whole page and not the page section specified by the id
. Is there a way I can only print the specific div
content?
question from:
https://stackoverflow.com/questions/65885900/printing-page-section-using-printjs-on-vuejs 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…