title: Uncaught (in promise) dom-to-image
body: <p>I have a page that has multiple canvas html elements. The website is actually built in angularjs and there are charts that are displayed on it which have been created in Qlik. I am trying to get a screenshot of the individual charts which are rendered as canvas elements on the browser.</p>
  
  <p>Using <a href="https://github.com/tsayen/dom-to-image" rel="nofollow noreferrer">https://github.com/tsayen/dom-to-image</a>, I am able to get the screenshot of just first chart using the following code:</p>
  
  <pre><code>var node = document.getElementById(divToPrint);
      domtoimage.toPng(node)
          .then(function (dataUrl) {
              var link = document.createElement('a');
              link.download = divToPrint + '.png';
              link.href = dataUrl;
              link.click();
          });
  </code></pre>
  
  <p>However, for all other charts, I get the following error:</p>
  
  <pre><code>Uncaught (in promise) Event {isTrusted: true, type: "error", target: null, currentTarget: null, eventPhase: 0, …}
  Promise.then (async)
  </code></pre>
  
  <p>I found somebody already posted this on github but there is no answer:
  <a href="https://github.com/tsayen/dom-to-image/issues/181" rel="nofollow noreferrer">https://github.com/tsayen/dom-to-image/issues/181</a></p>
  
  <p>Is there something missing in the code?</p>