hello , im trying to print a html component. When im printing i see all elements without the qr code. By doing some research i found the because the qrcode is a canva and i gotta convert the ccanva to a image. I did it with but convertion didn't work.
image : what i have when i print ( qrcode dont appear and the barcode does )
this is the function
printEticket(printContents) {
let printContents, popupWin;
// printContents = document.getElementById(ticket).innerHTML.toString();,
popupWin = window.open('', '_blank', 'top=0,left=0,height=100%,width=auto');
popupWin.document.open();
popupWin.document.write(`
<html>
<head>
<title>LOGIDOO</title>
<meta name="viewport" content="width=10000, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style> </style>
</head>
<body>
${printContents.nativeElement.innerHTML}
</body>
<script>
function convertCanvasToImage() {
var canvasElements = document.querySelectorAll('canvas');
canvasElements.forEach(function(canvas, index) {
var img = new Image();
img.src = canvas.toDataURL();
img.setAttribute('style', 'display:block; margin:auto;');
canvas.parentNode.replaceChild(img, canvas);
});
}
window.onload = function() {
convertCanvasToImage();
window.print();
window.onafterprint = function() {
window.close();
};
};
</script>
</html>
`);
popupWin.document.close();
}