title: html2Canvas unable to retrieve the data url in time for pdf generation
body: <p>I need help with assigning the data url I get from the html2canvas promise to the listingReportImg in the downloadPdf() function.</p>
  
  <p><strong>Expected Result:</strong></p>
  
  <pre><code>listingReportImg = data:image/png;base64,iVBORw0KGgoAAAANSUhEUg ...
  </code></pre>
  
  <p><strong>Logs</strong></p>
  
  <pre><code>listingReportImg::  undefined
  
  listing report uri:: 
  data:image/png;base64,iVBORw0KGgoAAAANSUhEUg ...
  </code></pre>
  
  <p><strong>listings.component.html</strong></p>
  
  <pre><code>&lt;button (click)="downloadPdf()"&gt;Print&lt;/button&gt;
  </code></pre>
  
  <p><strong>listings.component.ts</strong></p>
  
  <pre><code>listingReportToDataUrl(){
      let listingReport = document.getElementById('listing-report');
      console.log("listingReport:: ", listingReport);
      html2canvas( listingReport, { useCORS: true } )
          .then(function (canvas) {
              let listingReportUri = canvas.toDataURL('image/png');
              console.log("listing report uri::", listingReportUri);
              return listingReportUri;
          });
  }
  
  downloadPdf(){
      let listingReportImg = this.listingReportToDataUrl();
      console.log("listingReportImg:: ", listingReportImg);
      pdfMake.createPdf(listingReport( listingReportImg )).download('test.pdf');
  }
  </code></pre>