const { ref, onMounted } = Vue;
const app = {
setup() {
const generatePdf = () => {
html2canvas(document.querySelector(“#app”), {
scale: 2
}).then(canvas => {
const pdf = new jsPDF(‘p’, ‘mm’, ‘a4’);
pdf.addImage(canvas.toDataURL(‘image/png’), ‘PNG’, 0, 0, 210, 297);
pdf.save(‘example.pdf’);
});
}
return {
generatePdf
};
}
}
Vue.createApp(app).mount(‘#app’);
great job!
please tutorial preview before download
thanks! this was very useful for me! I couldnt have vue-html2canvas work for me so this saved my life