I am implementing screenshot feature using dom-to-image npm package in Quasar framwork(Vuejs) when I try to run it, its throwing exception in the attached image. below is my code.
//this called is called by below const domtoimage = require('dom-to-image')
export class Screenshot {
async take (div) {
try {
let dataUrl = await domtoimage.toJpeg(div, {
quality: 1,
bgcolor: 'white'
})
return dataUrl
} catch (error) {
console.log(error)
}
}
}
<template>
<div v-if="isDone == true" ref="printMainDashboard">
<q-page-container v-if="desktop">
<!--content-->
</q-page-container>
</div>
</template>
async printImage() {
try {
let dataUrl = await Screenshot.take(
this.$refs.printMainDashboard
);
} catch (error) {}
}