niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.42k stars 4.79k forks source link

html2canvas not rendering external images in npm version 1.0.0-alpha.11 #1495

Open Rameshck opened 6 years ago

Rameshck commented 6 years ago

Hi, We are using npm html2canvas to convert html to pdf. PDF is not rendering external image. My code :

html2canvas(document.getElementById('chartView'), {useCORS : true,logging:true }).then(function(canvas) { var img = canvas.toDataURL("image/png"); var doc = new jsPDF(); doc.addImage(img,'JPEG',0,0); doc.save('test.pdf');

Any suggestion please

Rameshck commented 6 years ago

Hi Team,

Need immediate assistance that html2canvas is not working in angular 2 production external environment . the same logic works in local & uat.

Application itself not rendering . If i remove html2canvas atleast application is working but pdf functionality not working.

Logic which i did 👍

Code 👍 html2pdf(element, {

margin: 1, filename: vzeid+'.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { dpi: 192, letterRendering: true,width: element.clientWidth+400, height:element.clientHeight+100 }, jsPDF: { unit: 'pt', format: [element.clientWidth, element.clientHeight], orientation: 'p'} }); }

Thanks in advance !!!!