QRCodeLibVB is a QR code generation library written in Visual Basic.
Generates Model 2 code symbols based on JIS X 0510.
Please refer to the QRCodeLib project or the built QRCodeLib.dll.
Imports Ys.QRCode
Imports System.Drawing
Public Sub Example()
Dim symbols As Symbols = New Symbols()
symbols.AppendText( "012345abcdefg" )
Dim image As Image = symbols( 0 ).GetImage()
End SubSet the constructor argument of the Symbols class to the value of the ErrorCorrectionLevel enum.
Dim symbols As Symbols = New Symbols(ErrorCorrectionLevel.H)Set it in the constructor of the Symbols class.
Dim symbols As Symbols = New Symbols(maxVersion:= 10 )Set it in the constructor of the Symbols class.
Dim symbols As Symbols = New Symbols(charsetName:= "UTF-8" )Set it in the constructor of the Symbols class. If you do not specify an upper limit of the model number, the upper limit is divided with model number 40.
Dim symbols As Symbols = New Symbols(allowStructuredAppend:= True )Here is an example of splitting the data when the data exceeds the model number 1 and obtaining the Image object for each QR code.
Dim symbols As Symbols = New Symbols(maxVersion:= 1 , allowStructuredAppend:= True )
symbols.AppendText( "abcdefghijklmnopqrstuvwxyz" )
For Each symbol As Symbol In symbols
Dim image As Image = symbol.GetImage()
NextUse the SaveBitmap method of the Symbol class.
Dim symbols As Symbols = New Symbols()
symbols.AppendText( "012345abcdefg" )
' 24bpp DIB
symbols( 0 ).SaveBitmap( "qrcode.bmp" )
' 1bpp DIB
symbols( 0 ).SaveBitmap( "qrcode.bmp" , monochrome:= True )
' 10 pixels per module
symbols( 0 ).SaveBitmap( "qrcode.bmp" , moduleSize:= 10 )
' Specify foreground and background colors.
symbols( 0 ).SaveBitmap( "qrcode.bmp" , foreRgb:= "#0000FF" , backRgb:= "#FFFF00" ) Use the SaveSvg method of the Symbol class.
Dim symbols As Symbols = New Symbols()
symbols.AppendText( "012345abcdefg" )
symbols( 0 ).SaveSvg( "qrcode.svg" )Use the Save method of the Image object.
Imports System.Drawing
Imports System.Drawing.Imaging
Dim symbols As Symbols = New Symbols()
symbols.AppendText( "012345" )
Dim image As Image = symbols( 0 ).GetImage()
' PNG
image.Save( "qrcode.png" , ImageFormat.Png)
' GIF
image.Save( "qrcode.gif" , ImageFormat.Gif)
' JPEG
image.Save( "qrcode.jpg" , ImageFormat.Jpeg)Use the GetBitmapBase64 method of the Symbol object.
Dim symbols As Symbols = New Symbols()
symbols.AppendText( "012345abcdefg" )
Dim data As String = symbols( 0 ).GetBitmapBase64()
Dim imgTag As String = "<img src=""data:image/bmp;base64," & data & """ />"Use the GetSvg method of the Symbol object.
Dim symbols As Symbols = New Symbols()
symbols.AppendText( "012345abcdefg" )
Dim svg As String = symbols( 0 ).GetSvg()