0

enter image description here

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) {}
    }
  • From the event and the dom-to-image code itself, it appears that the error is occurring either when rendering SVG into a temporary `` element, or earlier when inlining an image in the element being screenshotted. Could you include in your question a minimal `
    ` that throws this error when screenshotted?
    – kdau Jun 05 '21 at 20:13
  • @kdau onclick of button i am calling function printImage() which call a method take() from Screenshot class. the html is as shown above – Michael Phandera Jun 08 '21 at 19:11
  • Thanks. That HTML doesn't actually identify what could be causing the error, as it doesn't include any content. A [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) would be needed. – kdau Jun 11 '21 at 17:32

0 Answers0