VintaSoft Barcode .NET SDK v11.0
In This Topic
    Get barcode image as System.Windows.Media.PathGeometry object in WPF
    In This Topic

    Example: Here is an example that shows how to get barcode in vector form as a System.Windows.Media.PathGeometry object.

    Public Function GetBarcodeAsPathGeometry(barcode As BarcodeType, value As String) As PathGeometry
            ' create the barcode writer
            Dim barcodeWriter As New BarcodeWriter()
    
            ' set barcode writer settings
            barcodeWriter.Settings.Barcode = barcode
            barcodeWriter.Settings.Value = value
    
            ' return barcode as PathGeometry
            Return barcodeWriter.GetBarcodeAsPathGeometry()
    End Function
                  
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.WpfBarcode
    
    /// <summary>
    /// Returns a barcode in vector form as System.Windows.Media.PathGeometry object.
    /// </summary>
    /// <param name="barcodeType">Barcode type.</param>
    /// <param name="barcodeValue">Barcode value.</param>
    /// <returns>A barcode in vector form as System.Windows.Media.PathGeometry object.</returns>
    public System.Windows.Media.PathGeometry GetBarcodeAsPathGeometry(Vintasoft.WpfBarcode.BarcodeType barcodeType, string barcodeValue)
    {
        // create the barcode writer
        Vintasoft.WpfBarcode.BarcodeWriter barcodeWriter = new Vintasoft.WpfBarcode.BarcodeWriter();
    
        // set barcode writer settings
        barcodeWriter.Settings.Barcode = barcodeType;
        barcodeWriter.Settings.Value = barcodeValue;
    
        // return barcode as System.Windows.Media.PathGeometry
        return barcodeWriter.GetBarcodeAsPathGeometry();
    }