How can I append QR code to already existing canvas element?
DavidLJz opened this issue · 0 comments
DavidLJz commented
const canvas = document.getElementById("canva");
...
const qr = new QRious({
size: 250,
value: 'value',
foreground: 'black',
});
I want to render the QRious object on already existing canvas with specific dimensions. How to do that?
Edit: Sorry, I figured it out
ctx = canvas.getContext("2d");
const img = new Image();
img.onload = () => {
ctx.drawImage(img, 425, 700, 250, 250)
};
img.src = qr.toDataURL('image/jpeg');