VintaSoft Barcode .NET SDK v10.0
BarcodeWriter Class
Members  Example 




Vintasoft.WpfBarcode Namespace : BarcodeWriter Class
Class that allows to write barcodes to the image or in vector form.
Object Model
BarcodeWriter ClassWriterSettings Class
Syntax
'Declaration
 
<LicenseProviderAttribute(Vintasoft.WpfBarcode.VintasoftLicenseProvider)>
Public NotInheritable Class BarcodeWriter 
'Usage
 
Dim instance As BarcodeWriter
[LicenseProvider(Vintasoft.WpfBarcode.VintasoftLicenseProvider)]
public sealed class BarcodeWriter 
[LicenseProvider(Vintasoft.WpfBarcode.VintasoftLicenseProvider)]
public __gc __sealed class BarcodeWriter 
[LicenseProvider(Vintasoft.WpfBarcode.VintasoftLicenseProvider)]
public ref class BarcodeWriter sealed 
Example
This example shows how to generate image with Code128 barcode.
Imports System.Windows.Media.Imaging   
   
Imports Vintasoft.WpfBarcode   
Imports Vintasoft.WpfBarcode.SymbologySubsets   
   
''' <summary>   
''' Test that shows how to create an image with barcode using the BarcodeWriter class.   
''' </summary>   
Class BarcodeWriterExample   
	''' <summary>   
	''' Generates Code128 barcode.   
	''' </summary>   
	Public Shared Function TestCode128Barcode() As BitmapSource   
		' create the barcode writer   
		Dim writer As New BarcodeWriter()   
   
		' specify that writer must generate Code128 barcode   
		writer.Settings.Barcode = BarcodeType.Code128   
   
		' specify that writer must create output image as 24-bpp image   
		writer.Settings.PixelFormat = BarcodeImagePixelFormat.Bgr24   
   
		' specify that single bar width must be 3 pixels   
		writer.Settings.MinWidth = 3   
   
		' set the barcode value   
		writer.Settings.Value = "Test1234567"   
   
		' create image with barcode   
		Return writer.GetBarcodeAsBitmapSource()   
	End Function   
   
	''' <summary>   
	''' Generates SSCC-18 barcode.   
	''' </summary>      
	Public Shared Function TestSSCC18Barcode() As BitmapSource   
		' create the barcode writer   
		Dim writer As New BarcodeWriter()   
   
		' specify that writer must create output image as 24-bpp image   
		writer.Settings.PixelFormat = BarcodeImagePixelFormat.Bgr24   
   
		' specify that single bar width must be 3 pixels   
		writer.Settings.MinWidth = 3   
   
		' encode SSCC-18 barcode   
		BarcodeSymbologySubsets.SSCC18.Encode("012345678901234560", writer.Settings)   
   
		' create image with barcode   
		Return writer.GetBarcodeAsBitmapSource()   
	End Function   
   
	''' <summary>   
	''' Generates GS1-128 barcode.   
	''' </summary>      
	Public Shared Function TestGS1_128Barcode() As BitmapSource   
		' create the barcode writer   
		Dim writer As New BarcodeWriter()   
   
		' specify that writer must create output image as 24-bpp image   
		writer.Settings.PixelFormat = BarcodeImagePixelFormat.Bgr24   
   
		' specify that single bar width must be 3 pixels   
		writer.Settings.MinWidth = 3   
   
		' encode GS1-128 barcode   
		' GTIN                : 08699736690061   
		' SERIAL              : 30000000000720   
		' USE BY OR EXPIRY    : 110227   
		' BATCH/LOT           : TEST   
		BarcodeSymbologySubsets.GS1_128.Encode("(01)08699736690061(21)30000000000720(17)110227(10)TEST", writer.Settings)   
   
		' create image with barcode   
		Return writer.GetBarcodeAsBitmapSource()   
	End Function   
End Class
using System.Windows.Media.Imaging;
            
using Vintasoft.WpfBarcode;
using Vintasoft.WpfBarcode.SymbologySubsets;
            
/// <summary>
/// Test that shows how to create an image with barcode using the BarcodeWriter class.
/// </summary>
class BarcodeWriterExample
{
    /// <summary>
    /// Generates Code128 barcode.
    /// </summary>
    public static BitmapSource TestCode128Barcode()
    {
        // create the barcode writer
        BarcodeWriter writer = new BarcodeWriter();
            
        // specify that writer must generate Code128 barcode
        writer.Settings.Barcode = BarcodeType.Code128;
            
        // specify that writer must create output image as 24-bpp image
        writer.Settings.PixelFormat = BarcodeImagePixelFormat.Bgr24;
            
        // specify that single bar width must be 3 pixels
        writer.Settings.MinWidth = 3;
            
        // set the barcode value
        writer.Settings.Value = "Test1234567";
            
        // create image with barcode
        return writer.GetBarcodeAsBitmapSource();
    }
            
    /// <summary>
    /// Generates SSCC-18 barcode.
    /// </summary>   
    public static BitmapSource TestSSCC18Barcode()
    {
        // create the barcode writer
        BarcodeWriter writer = new BarcodeWriter();
            
        // specify that writer must create output image as 24-bpp image
        writer.Settings.PixelFormat = BarcodeImagePixelFormat.Bgr24;
            
        // specify that single bar width must be 3 pixels
        writer.Settings.MinWidth = 3;
            
        // encode SSCC-18 barcode
        BarcodeSymbologySubsets.SSCC18.Encode("012345678901234560", writer.Settings);
            
        // create image with barcode
        return writer.GetBarcodeAsBitmapSource();
    }
            
    /// <summary>
    /// Generates GS1-128 barcode.
    /// </summary>   
    public static BitmapSource TestGS1_128Barcode()
    {
        // create the barcode writer
        BarcodeWriter writer = new BarcodeWriter();
            
        // specify that writer must create output image as 24-bpp image
        writer.Settings.PixelFormat = BarcodeImagePixelFormat.Bgr24;
            
        // specify that single bar width must be 3 pixels
        writer.Settings.MinWidth = 3;
            
        // encode GS1-128 barcode
        // GTIN                : 08699736690061
        // SERIAL              : 30000000000720
        // USE BY OR EXPIRY    : 110227
        // BATCH/LOT           : TEST
        BarcodeSymbologySubsets.GS1_128.Encode(
            "(01)08699736690061(21)30000000000720(17)110227(10)TEST", writer.Settings);
            
        // create image with barcode
        return writer.GetBarcodeAsBitmapSource();
    }
}
Inheritance Hierarchy

System.Object
   Vintasoft.WpfBarcode.BarcodeWriter

Requirements

Target Platforms: Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

See Also

Reference

BarcodeWriter Members
Vintasoft.WpfBarcode Namespace