Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not Generating new QR Code #271

Open
khvip87 opened this issue Jan 27, 2025 · 2 comments
Open

Not Generating new QR Code #271

khvip87 opened this issue Jan 27, 2025 · 2 comments

Comments

@khvip87
Copy link

khvip87 commented Jan 27, 2025

if you try to create dynamic QR codes within a loop, it will generate same SVG / results for all different data you pass.

SAMPLE CODE:

for (let i = 0; i < 5; i++) {     
          const qrCode = new QRCodeStyling({
            width: 300,
            height: 300,
            type: "svg",
            data,
            image: "https://anyImage/pdfs/svg2.svg",
            backgroundOptions: {
              color: "#FBFBF5",
            },
            imageOptions: {
              crossOrigin: "anonymous",
              imageSize: 0.4,
            },
          });
       
          qrCode.append(document.getElementById("canvas")); 
        }

RESULT :

Image

@kozakdenys
Copy link
Owner

@khvip87 from your code it seems like you are using the same data for each iteration

@khvip87
Copy link
Author

khvip87 commented Jan 27, 2025

thank you, but this code is not the full code.
data is is being updated while looping ,

try use my code above and just pass Math.Random for data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants