VintaSoft Barcode .NET SDK 15.0: Documentation for .NET developer
In This Topic
    Get barcode in vector form as SkiaSharp.SKPath object
    In This Topic
    Here is C#/VB.NET code that demonstrates how to generate vector barcode as a SkiaSharp.SKPath object.

    /// <summary>
    /// Returns a barcode in vector form as SkiaSharp.SKPath object.
    /// </summary>
    /// <param name="barcodeType">Barcode type.</param>
    /// <param name="barcodeValue">Barcode value.</param>
    /// <returns>A barcode in vector form as SkiaSharp.SKPath object.</returns>
    public static SkiaSharp.SKPath GetBarcodeAsGraphicsPath(Vintasoft.Barcode.BarcodeType barcodeType, string barcodeValue)
    {
        // create the barcode writer
        using (Vintasoft.Barcode.BarcodeWriter barcodeWriter = new Vintasoft.Barcode.BarcodeWriter())
        {
            // set barcode writer settings
            barcodeWriter.Settings.Barcode = barcodeType;
            barcodeWriter.Settings.Value = barcodeValue;
    
            // return barcode as GraphicsPath
            return Vintasoft.Barcode.SkiaSharpExtensions.GetBarcodeAsSKPath(barcodeWriter);
        }
    }
    
    ''' <summary>
    ''' Returns a barcode in vector form as SkiaSharp.SKPath object.
    ''' </summary>
    ''' <param name="barcodeType">Barcode type.</param>
    ''' <param name="barcodeValue">Barcode value.</param>
    ''' <returns>A barcode in vector form as SkiaSharp.SKPath object.</returns>
    Public Shared Function GetBarcodeAsGraphicsPath(barcodeType As Vintasoft.Barcode.BarcodeType, barcodeValue As String) As SkiaSharp.SKPath
        ' create the barcode writer
        Using barcodeWriter As New Vintasoft.Barcode.BarcodeWriter()
            ' set barcode writer settings
            barcodeWriter.Settings.Barcode = barcodeType
            barcodeWriter.Settings.Value = barcodeValue
    
            ' return barcode as GraphicsPath
            Return Vintasoft.Barcode.SkiaSharpExtensions.GetBarcodeAsSKPath(barcodeWriter)
        End Using
    End Function