VintaSoft Barcode .NET SDK 14.3: Documentation for .NET developer
In This Topic
    Get barcode in vector form as System.Drawing.Drawing2D.GraphicsPath object
    In This Topic
    Example: Here is an example that shows how to generate vector barcode as a System.Drawing.Drawing2D.GraphicsPath object.
    /// <summary>
    /// Returns a barcode in vector form as System.Drawing.Drawing2D.GraphicsPath object.
    /// </summary>
    /// <param name="barcodeType">Barcode type.</param>
    /// <param name="barcodeValue">Barcode value.</param>
    /// <returns>A barcode in vector form as System.Drawing.Drawing2D.GraphicsPath object.</returns>
    public static System.Drawing.Drawing2D.GraphicsPath 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.GdiExtensions.GetBarcodeAsGraphicsPath(barcodeWriter);
        }
    }
    
    ''' <summary>
    ''' Returns a barcode in vector form as System.Drawing.Drawing2D.GraphicsPath object.
    ''' </summary>
    ''' <param name="barcodeType">Barcode type.</param>
    ''' <param name="barcodeValue">Barcode value.</param>
    ''' <returns>A barcode in vector form as System.Drawing.Drawing2D.GraphicsPath object.</returns>
    Public Shared Function GetBarcodeAsGraphicsPath(barcodeType As Vintasoft.Barcode.BarcodeType, barcodeValue As String) As System.Drawing.Drawing2D.GraphicsPath
        ' 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.GdiExtensions.GetBarcodeAsGraphicsPath(barcodeWriter)
        End Using
    End Function