When I use html2pdf() function to download in PDF format, in that image is not displaying rendering from link. Below mentioned link used, it leaves blank space in PDF. Not displaying any image in PDF.
"https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=http://hellovcard.com/6160175f9b7f3&choe=UTF-8&chof=gif"
<img src="https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=http://hellovcard.com/6160175f9b7f3&choe=UTF-8&chof=gif" alt="qr code">
Code I have used:
function saveAsPDF() {
var element = document.getElementById('printableArea');
var opt = {
margin: 0.3,
filename: 'download.pdf',
image: {type: 'jpeg', quality: 1},
html2canvas: {scale: 4, dpi: 72, letterRendering: true},
jsPDF: {unit: 'in', format: 'A2'},
html2canvas: {
onclone: (element) => {
const svgElements = Array.from(element.querySelectorAll('svg'));
svgElements.forEach(s => {
const bBox = s.getBBox();
s.setAttribute("x", bBox.x);
s.setAttribute("y", bBox.y);
s.setAttribute("width", bBox.width);
s.setAttribute("height", bBox.height);
})
}
},
};
html2pdf().set(opt).from(element).save();
}
