Barcode Plugin for Xojo

QRCodeGenerator.GenerateToSVGString Method

Generates a QRCode into a SVG vector format, returned as string which can then be saved into SVG file. This variation allows choosing the error correction level.

GenerateToSVGString(
   data as String,
   errorCorrection as ErrorCorrectionType) as String

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.

Returns

String

Remarks


Dim qr as QRCodeGenerator = new QRCodeGenerator()
Dim f as FolderItem
Dim stream as TextOutputStream
Dim errorCorrection as QRCodeGenerator.ErrorCorrectionType

f = GetSaveFolderItem("*.*","Test.svg")

if f <> nil then
   
    stream = TextOutputStream.Create(f)
   
    if stream <> nil then
       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
      
       stream.Write qr.GenerateToSVGString(tbQRCodeData.Text, errorCorrection)
      
       stream.Close()
    end if
end if


See Also

QRCodeGenerator Class