Barcode Plugin for Xojo

BarcodeGenerator.GenerateToSVGString Method

Generates Barcode from String value, returning it as String that contains formatting for SVG vector image.

GenerateToSVGString(
   type as BarcodeType,
   value as String,
   printTextBellow as Boolean) as String

Parameters

type
The type of Barcode to generate.
value
The value to generate the barcode from.
printTextBellow
True if wanting barcode text label included, else false.

Returns

String

Remarks


Dim b as BarcodeGenerator = new BarcodeGenerator()
Dim f as FolderItem
Dim stream as TextOutputStream
Dim value as String
Dim data as String

data = "12345678"

b.QuietZoneIncludedInPadding = true
b.Padding = 10
b.BarWidth = 1
b.IncludeLeadingAndTralingBrackets = true


value =b.GenerateToSVGString(BarcodeGenerator.BarcodeType.Code128, data, true)

if b.LastError <> BarcodeGenerator.ErrorCodeType.NO_ERROR then
    // Handle errors here
    MsgBox "Error generating barcode"
    return
end if

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

if f <> nil then
    stream = TextOutputStream.Create(f)
   
    if stream <> nil then
      
       stream.Write value
       stream.Close()
    end if
end if

See Also

BarcodeGenerator Class