QRCodeGenerator.GenerateToRawBitmap Method
Generates a unscaled QRCode into new RawBitmap object.

GenerateToRawBitmap(
data
as String,
errorCorrection
as ErrorCorrectionType,
borderSize
as UInt8)
as RawBitmap
Parameters
- data
- The data to put in the QRCode.
- errorCorrection
- Error correction level to use for the QRCode. (More error correction means bigger QRCode). This can be any value that is defined in the ErrorCorrectionType enum.
- borderSize
- Size of the white border to put around the QRCode in pixels.
Returns
- RawBitmap
- The generated QRCode as RawBitmap or nil if there was a error. If there was error then you can see the LastError property to check which error occurred.
Remarks
Dim qr as QRCodeGenerator = new QRCodeGenerator()
Dim bitmap as RawBitmap
Dim errorCorrection as QRCodeGenerator.ErrorCorrectionType
if optLow.Value then
errorCorrection = QRCodeGenerator.ErrorCorrectionType.LOW
elseif optMedium.Value then
errorCorrection =QRCodeGenerator.ErrorCorrectionType.MEDIUM
elseif optQuartile.Value then
errorCorrection = QRCodeGenerator.ErrorCorrectionType.QUARTILE
else
errorCorrection = QRCodeGenerator.ErrorCorrectionType.HIGH
end if
bitmap = qr.GenerateToRawBitmap(tbQRCodeData.Text, errorCorrection,Slider1.Value)
if bitmap <> nil then
qrCodeImage = RawBitmapConverter.ToPicture(bitmap)
qrCodeBitmap = bitmap
Canvas1.Invalidate()
else
if qr.LastError = QRCodeGenerator.ErrorCodeType.DATA_TO_LONG_ERROR then
MsgBox "Could not generate QRCode, data was to long"
elseif qr.LastError = QRCodeGenerator.ErrorCodeType.COULD_NOT_CONVERT_DATA_TO_UTF8_ERROR then
MsgBox "Could not generate QRCode because data could not be converted to UTF8"
elseif qr.LastError = QRCodeGenerator.ErrorCodeType.NO_DATA_SUPPLIED_ERROR then
MsgBox "Could not generate QRCode because no data was supplied"
else
MsgBox "Could not generate QRCode because of unknown error"
end if
end if
See Also
QRCodeGenerator Class