Print a page section on button-click in Vue
Use a button on a Vue component to start a print dialog and print a specific section. Setup We will use a small library called ‘html2paper’. First install the said library in your Vue project - npm install vue-html-to-paper Add library to your code in main.js - // main.js 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); // ... We will use a Vuetify example to demonstrate how this is used in Vue code, because - why not? ...