-1
var doc = document.getElementById('name').innerHTML;
html2canvas(doc, {
useCORS: true,
allowTaint: true,
onrendered: function(canvas) {
var imgData = canvas.toDataURL(
'image/png');
var doc = new jsPDF('p', 'mm');
doc.addImage(imgData, 'PNG', 10, 10);
doc.save('sample-file.pdf');
}
});
我收到以下錯誤通HTML內容作爲一個變量來html2canvas生成PDF
jspdf.min.js:143 Uncaught (in promise) Proxy must be used when rendering url
我已經嘗試設置代理爲http://localhost:8080,它沒有工作..
任何建議?