title: Provided element is not within a Document - Reactjs
body: <p>I am trying to send HTML invoices to users as Image.</p>
  
  <p>For that purpose i am using html2canvas library, but it is continuously giving me error:</p>
  
  <blockquote>
    <p>Provided element is not within a Document</p>
  </blockquote>
  
  <p>Here is what i am trying to do in componentDidMount()</p>
  
  <pre><code>html2canvas(document.getElementById('invoice'), {
          logging: true,
          profile: true,
          useCORS: true}).then(function(canvas) {
      var data = canvas.toDataURL('image/jpeg', 0.9);
      var src = encodeURI(data);
      console.log(src);
  });
  </code></pre>
  
  <p>And <strong>invoice</strong> element do exist in DOM.</p>
  
  <p>What could be wrong?</p>