Barcode Plugin for Xojo

BarcodeGenerator.GenerateToSVGString Method

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

GenerateToSVGString(
   type as BarcodeType,
   value as UInt64,
   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

For barcode standards that have length requirements then zeros will be appended in-front of the number if needed to pad the value to the needed length.


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

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