VintaSoft Barcode .NET SDK v11.0
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 get barcode in vector fom as a System.Drawing.Drawing2D.GraphicsPath object.

    Public Function GetBarcodeAsGraphicsPath(barcode As BarcodeType, value As String) As GraphicsPath
            ' create the barcode writer
            Dim barcodeWriter As New BarcodeWriter()
    
            ' set barcode writer settings
            barcodeWriter.Settings.Barcode = barcode
            barcodeWriter.Settings.Value = value
    
            ' return barcode as GraphicsPath
            Return barcodeWriter.GetBarcodeAsGraphicsPath()
    End Function
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Barcode
    
    /// <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 System.Drawing.Drawing2D.GraphicsPath GetBarcodeAsGraphicsPath(Vintasoft.Barcode.BarcodeType barcodeType, string barcodeValue)
    {
        // create the barcode writer
        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 barcodeWriter.GetBarcodeAsGraphicsPath();
    }