jsPdf using html2canvas.js: Uncaught Error: Supplied data is not a JPEG
<p>I am using jsPDF and html2Canvas to generate a PDF.</p>

<p>It works if I target the document.body. </p>

<pre><code>&lt;script type="text/javascript"&gt;
  function pdfDownload() {
  var pdf = new jsPDF('p', 'pt', 'a4');
  pdf.addHTML(document.body, function () {
  pdf.save('test.pdf');
  });
}&lt;/script&gt;
</code></pre>

<p>However if I try to use an id on a div #pdfcontent I get:</p>

<p>"Uncaught Error: Supplied data is not a JPEG"</p>

<pre><code>&lt;script type="text/javascript"&gt;
  function pdfDownload() {
  var pdf = new jsPDF('p', 'pt', 'a4');
  pdf.addHTML($('#pdfcontent')[0], function () {
  pdf.save('test.pdf');
  });
}&lt;/script&gt;
</code></pre>

<p>Help please</p>