The problem is most likely the version of html2canvas
you used. html2canvas 0.4.1
is not going to work. It should be html2canvas 1.0.0-alpha.11
or higher. However, current version, html2canvas 1.0.0-rc.3 doesn't work either, it also gives me a blank page. At least html2canvas 1.0.0-alpha.12 still works for me.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js"
integrity="sha384-NaWTHo/8YCBYJ59830LTz/P4aQZK1sS0SneOgAvhsIl3zBu8r9RevNg5lHCHAuQ/"
crossorigin="anonymous"></script>
<script src="~/lib/html2canvas/html2canvas.min.js"></script>
<!-- html2canvas 1.0.0-alpha.11 or html2canvas 1.0.0-alpha.12 is needed -->
<script>
function download() {
let pdf = new jsPDF('p', 'pt', 'a4');
pdf.html(document.getElementById('toPDF'), {
callback: function () {
window.open(pdf.output('bloburl'));
}
});
}
</script>
Update: the latest version that works for me is html2canvas v1.0.0-rc.1