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

Facing issue while generating qrcode png content #65

Open
nitin455 opened this issue Jan 30, 2024 · 2 comments
Open

Facing issue while generating qrcode png content #65

nitin455 opened this issue Jan 30, 2024 · 2 comments

Comments

@nitin455
Copy link

I am trying to use this library for generating QR code. I am calling qrcode.PNG() function to get bytes of qrcode in PNG form.
But the problem is, i am not getting consistent results from this lib.

Below is my code:

qcode, err := qrcode.New("CONTENT-TO-BE-USED", qrcode.Medium)
if err != nil {
fmt.Println(err)
}
b, err := qcode.PNG(100) // tried different sizes like 256, 140, 130, and 100
if err != nil {
fmt.Println(err)
}
t.QRCode = string(b)

here t.QRCode is used in html template with image tag to load qr code on web page.

Anything is wrongly done here?

@nitin455
Copy link
Author

nitin455 commented Jan 30, 2024

image

here is sample qr code generated. This doesnt created fully. The bottom part is missing.

This is not consistent. Few times, it generates proper qr code but few times it fails.

@tryoasnafi
Copy link

this is probably cause by t.QRCode = string(b) which result incorrect html parsing, but i need the reproducable examples to know what is the real problem

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