Open bkyerv opened 1 year ago
same here
I'm also looking for a solution to generate QR codes without access to DOM
Try using node-canvas
same here
Not a fix for this library, but if anyone is desperate here might be some leads
A solution is just using QRCode.toString
instead of QRCode.toDataURL
.
You'll get an SVG instead of a PNG. Good enough for many cases.
I am encountering an error when attempting to generate a QR code using the qrcode library within a Cloudflare Worker. The error message is "You need to specify a canvas element".
Error stack:
Environment:
Steps to Reproduce:
Expected Result: The QR code should be generated successfully.
Actual Result: Encountering the above error, which seems to suggest a canvas element is required.
I would appreciate any guidance or suggestions on how to resolve this issue, especially considering the context of using Cloudflare Workers where a DOM-based canvas isn't available.
Thank you!
Below is the source code for the worker