Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QR generated by FoxBarcodeQR doesn't contain the full content

Rajesh Karunakaran

Programmer
Sep 29, 2016
553
MU
Dear friends,

I'm using the community library FoxBarcodeQR for generating qr codes.
Using the below commands

Code:
loQr = CREATEOBJECT("FoxBarcodeQR")
s=REPLICATE('X',950)+'...'
lcQRImage = loQr.QRBarcodeImage(s, lpath + "qrimage5.png", 5, 2)

But the result qr code when scanned doesn't show the full 953 characters.
 
I think there is an upper limit of what can be encoded into what size of QR image, specifically what number of QR squares. I think some of the parameters are about the size. If you already used the largest size then you're asking for too much. A finite size always can only encode a finite number of bytes or characters, obviously. I'd also try with something like REPLICATE('1234567890',95)+'abc', for easier verification of the scan result.

Edit: Looking at https://github.com/VFPX/FoxBarcodeQR you can go up from 5 for 165x165 to 12 for 396x396.
Documentation speaks of more than 255 characters - which it does, obviously, because that was a limitation of an earlier version. It doesn't mean the upper limit is now unrestricted, but it doesn't provide information about the upper limits. I guess it varies with the necessary number of bits and the bits used for correction bits and so the correction level.
 
Last edited:
This is actually for an e-Invoice. The qr data is base64 encoded and is JWT. The sample qr code has 953 characters and that's why I am testing with a 953 characters string. I am scanning with my mobile phone's qr scanner. When scanning the sample one, I can see the full content. When I generate qr of my data for qr with the library, the result qr when scanned shows truncated data. I tried with all sizes but truncates the same way. I think, there is something, maybe a setting, that I'm missing.
 
Chriss, I am using an older version it seems.
I have the new version 2.10. Let me try that.

Will update status here.
 
[SOLVED]

Chriss,
The new version gives the complete content.
I guess, the old version was not supporting above 255 characters

Thanks for your support
 
Just as sidenote: In case the QR code can't encode the data you plan to encode, you can always encode a URL that points to the data that's too large to encode, so storing JWTs in a db and retriving them by www.yourdomain.in/jwts/?id=qrcode could work with far smaller QR codes, too. if the QR code only encodes the lookup id(entifier) and even with only 255 bytes allows 2^2048 different JSON web tokens.
 

Part and Inventory Search

Sponsor

Back
Top