-
I have been using the base This library has much nicer customisation options than that base qrcode package but I am unsure about usage here. qrcodeconst qrcode = await QRCode.toDataURL('https://www.youtube.com/watch?v=dQw4w9WgXcQ') This works, server side, and I can use the returned data url as an qrcode-with-logosI could not see from the documentation a direct replacement for the code above, so I tried this: const gen = new QrCodeWithLogo({
content: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
width: 380,
cornersOptions: {},
dotsOptions: {},
nodeQrCodeOptions: {}
})
const canvas = await gen.getCanvas()
const qrcode = canvas.toDataURL() This does not work. From the API, it seems to use a canvas you must pass a Is there a way to just get this data url like you can with the Does this library only work in the browser? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@caprica |
Beta Was this translation helpful? Give feedback.
@caprica
Yes, this library only work in the browser.
It use the canvas to draw different style, so it doesn't work in SSR.
In the future, I plan to use svg to draw QR codes to solve the problem of server rendering.