Neodynamic Barcode Professional for WPF
Microsoft .NET Framework 3.0 or greater
Creating TIFF (Tagged Image File Format) barcodes using C# or VB.NET and Barcode Professional for WPF is a very simple task. In the following lines we'll describe some common scenarios about TIFF barcodes generation.
Use the overloaded Save() method that BarcodeBuilder class (part of Barcode Professional for WPF package) features.
Example: You want to encode the data 1234567890 in Code 128 Symbology and then save the barcode image in TIFF format at 300DPI
Private Sub SaveBarcode()
'Create a BarcodeBuilder object
Dim bc As New Neodynamic.WPF.BarcodeBuilder()
'Set the barcode symbology to Code 128
bc.Symbology = Neodynamic.WPF.Symbology.Code128
'Set the value to encode
bc.Code = "1234567890"
'Barcode dimensions settings
bc.BarcodeUnit = Neodynamic.WPF.BarcodeUnit.Inch
bc.BarHeight = 1.5D
bc.BarWidth = 0.02D
'Output image settings
bc.ImageSettings.Dpi = 300
bc.ImageSettings.ImageFormat = Neodynamic.WPF.ImageFormat.Tiff
'Save the TIFF barcode image on disk
bc.Save("C:\barcode128.tif")
End Sub
private void SaveBarcode()
{
//Create a BarcodeBuilder object
Neodynamic.WPF.BarcodeBuilder bc = new Neodynamic.WPF.BarcodeBuilder();
//Set the barcode symbology to Code 128
bc.Symbology = Neodynamic.WPF.Symbology.Code128;
//Set the value to encode
bc.Code = "1234567890";
//Barcode dimensions settings
bc.BarcodeUnit = Neodynamic.WPF.BarcodeUnit.Inch;
bc.BarHeight = 1.5d;
bc.BarWidth = 0.02d;
//Output image settings
bc.ImageSettings.Dpi = 300;
bc.ImageSettings.ImageFormat = Neodynamic.WPF.ImageFormat.Tiff;
//Save the TIFF barcode image on disk
bc.Save(@"C:\barcode128.tif");
}
Based on the previous scenario, just specify the ImageSettings.PixelFormat property to System.Windows.Media.PixelFormats.BlackWhite.
Private Sub SaveBarcode()
'Create a BarcodeBuilder object
Dim bc As New Neodynamic.WPF.BarcodeBuilder()
'Set the barcode symbology to Code 128
bc.Symbology = Neodynamic.WPF.Symbology.Code128
'Set the value to encode
bc.Code = "1234567890"
'Barcode dimensions settings
bc.BarcodeUnit = Neodynamic.WPF.BarcodeUnit.Inch
bc.BarHeight = 1.5D
bc.BarWidth = 0.02D
'Output image settings
bc.ImageSettings.Dpi = 300
bc.ImageSettings.ImageFormat = Neodynamic.WPF.ImageFormat.Tiff
'Set monochrome
bc.ImageSettings.PixelFormat = System.Windows.Media.PixelFormats.BlackWhite
'Save the TIFF barcode image on disk
bc.Save("C:\barcode128_BW.tif")
End Sub
private void SaveBarcode()
{
//Create a BarcodeBuilder object
Neodynamic.WPF.BarcodeBuilder bc = new Neodynamic.WPF.BarcodeBuilder();
//Set the barcode symbology to Code 128
bc.Symbology = Neodynamic.WPF.Symbology.Code128;
//Set the value to encode
bc.Code = "1234567890";
//Barcode dimensions settings
bc.BarcodeUnit = Neodynamic.WPF.BarcodeUnit.Inch;
bc.BarHeight = 1.5d;
bc.BarWidth = 0.02d;
//Output image settings
bc.ImageSettings.Dpi = 300;
bc.ImageSettings.ImageFormat = Neodynamic.WPF.ImageFormat.Tiff;
//Set monochrome
bc.ImageSettings.PixelFormat = System.Windows.Media.PixelFormats.BlackWhite;
//Save the TIFF barcode image on disk
bc.Save(@"C:\barcode128_BW.tif");
}
The CMYK color system is often used in printing inks for paper. This type of color representation is of the form CMYK (C%, M%, Y%, K%), where C, M, Y, and K are the percent values for the cyan, magenta, yellow, and black values of the color.
Based on the previous scenario, just specify the ImageSettings.PixelFormat property to System.Windows.Media.PixelFormats.Cmyk32.
Private Sub SaveBarcode()
'Create a BarcodeBuilder object
Dim bc As New Neodynamic.WPF.BarcodeBuilder()
'Set the barcode symbology to Code 128
bc.Symbology = Neodynamic.WPF.Symbology.Code128
'Set the value to encode
bc.Code = "1234567890"
'Barcode dimensions settings
bc.BarcodeUnit = Neodynamic.WPF.BarcodeUnit.Inch
bc.BarHeight = 1.5D
bc.BarWidth = 0.02D
'Output image settings
bc.ImageSettings.Dpi = 300
bc.ImageSettings.ImageFormat = Neodynamic.WPF.ImageFormat.Tiff
'Set CMYK
bc.ImageSettings.PixelFormat = System.Windows.Media.PixelFormats.Cmyk32
'Save the TIFF barcode image on disk
bc.Save("C:\barcode128_CMYK.tif")
End Sub
private void SaveBarcode()
{
//Create a BarcodeBuilder object
Neodynamic.WPF.BarcodeBuilder bc = new Neodynamic.WPF.BarcodeBuilder();
//Set the barcode symbology to Code 128
bc.Symbology = Neodynamic.WPF.Symbology.Code128;
//Set the value to encode
bc.Code = "1234567890";
//Barcode dimensions settings
bc.BarcodeUnit = Neodynamic.WPF.BarcodeUnit.Inch;
bc.BarHeight = 1.5d;
bc.BarWidth = 0.02d;
//Output image settings
bc.ImageSettings.Dpi = 300;
bc.ImageSettings.ImageFormat = Neodynamic.WPF.ImageFormat.Tiff;
//Set CMYK
bc.ImageSettings.PixelFormat = System.Windows.Media.PixelFormats.Cmyk32;
//Save the TIFF barcode image on disk
bc.Save(@"C:\barcode128_CMYK.tif");
}
Use the GetBarcodeImageBinary() method that BarcodeBuilder class (part of Barcode Professional for WPF package) features.
Example: You want to encode the data 1234567890 in Code 128 and then get a binary representation of the barcode image in TIFF format at 300DPI
Private Function GetTiffBarcode() As Byte()
'Create a BarcodeBuilder object
Dim bc As New Neodynamic.WPF.BarcodeBuilder()
'Set the barcode symbology to Code 128
bc.Symbology = Neodynamic.WPF.Symbology.Code128
'Set the value to encode
bc.Code = "1234567890"
'Barcode dimensions settings
bc.BarcodeUnit = Neodynamic.WPF.BarcodeUnit.Inch
bc.BarHeight = 1.5D
bc.BarWidth = 0.02D
'Output image settings
bc.ImageSettings.Dpi = 300
bc.ImageSettings.ImageFormat = Neodynamic.WPF.ImageFormat.Tiff
'Get the TIFF barcode image in binary format
Return bc.GetBarcodeImageBinary()
End Function
private byte[] GetTiffBarcode()
{
//Create a BarcodeBuilder object
Neodynamic.WPF.BarcodeBuilder bc = new Neodynamic.WPF.BarcodeBuilder();
//Set the barcode symbology to Code 128
bc.Symbology = Neodynamic.WPF.Symbology.Code128;
//Set the value to encode
bc.Code = "1234567890";
//Barcode dimensions settings
bc.BarcodeUnit = Neodynamic.WPF.BarcodeUnit.Inch;
bc.BarHeight = 1.5d;
bc.BarWidth = 0.02d;
//Output image settings
bc.ImageSettings.Dpi = 300;
bc.ImageSettings.ImageFormat = Neodynamic.WPF.ImageFormat.Tiff;
//Get the TIFF barcode image in binary format
return bc.GetBarcodeImageBinary();
}
We provide best-in-class customer service and support directly from members of our dev team! If we are available when you contact us, you will get a response in few minutes; otherwise the maximum turnaround is 24hs in most cases.