It's not a complete QRCode library, but it covers it enough to be very useful. Encodes Numeric, Alpha Numeric, Byte.
You can display into a graphic control/windows
Save QRCode in format desired
Print QRCode
You can display into a graphic control/windows
Code:
sText = "otpauth://totp/MyCompany?secret=NAR5XTDD3EQU22YU" '// Create the QRCode matrix '// (DataToMakeIntoQR, ErrorCorectionLevel, ArrayToPutMatrixIn) returns version used for supplied data Version = CreateQRCode (sText, 3, aQRMatrix()) ' 1=L 7%, 2=M 15%, 3=Q 25%, 4=H 30% '//Convert Matrix into device-independent bitmap in a dynamic string and then display it in a control or Graphic Window sBuffer = GetQRCodeAsBITSstr (aQRMatrix(), 3, 6) ' Matrix, border, Magnification lgWidth = CVL(sBuffer,1) lgHeight = CVL(sBuffer,5) GRAPHIC WINDOW NEW "Version "+FORMAT$(Version), 10, 10, lgWidth, lgHeight TO hWinVar GRAPHIC ATTACH hWinVar, 0 GRAPHIC SET BITS sBuffer GRAPHIC WAITKEY$
Code:
sText = "otpauth://totp/MyCompany?secret=NAR5XTDD3EQU22YU" '// Create the QRCode matrix '// (DataToMakeIntoQR, ErrorCorectionLevel, ArrayToPutMatrixIn) returns version used for supplied data Version = CreateQRCode (sText, 3, aQRMatrix()) ' 1=L 7%, 2=M 15%, 3=Q 25%, 4=H 30% '// Save QRCode as an image filename extention determins format ie: myImage.png myImage.jpg myImage.tif myImage.gif myImage.bmp SaveQRCodeAsImage (aQRMatrix(),"myImage.png", 3, 6) ' Matrix, File Name, border, Magnification
Print QRCode
Code:
sText = "otpauth://totp/MyCompany?secret=NAR5XTDD3EQU22YU" '// Create the QRCode matrix '// (DataToMakeIntoQR, ErrorCorectionLevel, ArrayToPutMatrixIn) returns version used for supplied data Version = CreateQRCode (sText, 3, aQRMatrix()) ' 1=L 7%, 2=M 15%, 3=Q 25%, 4=H 30% '//Convert Matrix into device-independent bitmap in a dynamic string and then Print it LOCAL xsize, ysize, hbmp, hbmp2 AS LONG sBuffer = GetQRCodeAsBITSstr (aQRMatrix(), 3, 6) ' Matrix, border, Magnification IF sBuffer <> "" THEN xsize = CVL(sBuffer,1) ' Get Size of Bar Code ysize = CVL(sBuffer,5) GRAPHIC BITMAP NEW xsize, ysize TO hbmp ' Create bitmap 1 GRAPHIC ATTACH hbmp,0 GRAPHIC SET BITS sBuffer ' Put BITS in it GRAPHIC BITMAP NEW xsize*2, ysize*2 TO hbmp2 ' Create bitmap double size GRAPHIC ATTACH hbmp2,0 GRAPHIC STRETCH PAGE hBmp, 0 ' stretch bitmap 1 in it XPRINT ATTACH CHOOSE XPRINT SCALE (0,0)-(8.5,11) 'scale paper size XPRINT XPRINT " Page Scaled at (8.5,11)" XPRINT " BMP1 size : " + FORMAT$(xsize),FORMAT$(ysize) XPRINT " Scaled size : " + FORMAT$(xsize / XPRINT(PPI.X), 4),FORMAT$(ysize / XPRINT(PPI.Y),4) XPRINT " BMP2 size : " + FORMAT$(xsize*2),FORMAT$(ysize*2) XPRINT " Scaled size : " + FORMAT$(xsize*2 / XPRINT(PPI.X), 4),FORMAT$(ysize*2 / XPRINT(PPI.Y),4) XPRINT SET POS (5, .5) XPRINT "Barcode under me" XPRINT COPY hbmp, 0 TO (5, 0.7) 'put barcode at 5 in x .7 in XPRINT COPY hbmp2, 0 TO (5-((xsize*2/XPRINT(PPI.X)+.1)), ysize/ XPRINT(PPI.Y)+.8) XPRINT CLOSE GRAPHIC ATTACH hbmp,0 ' Cleanup GRAPHIC BITMAP END GRAPHIC ATTACH hbmp2,0 GRAPHIC BITMAP END END IF
Comment