How to Generate & Recognize Barcode using Custom Width inside .NET Apps

This Technical tip explains how .NET developers can generate barcode using custom width support inside their applications using Aspose.BarCode for .NET. Originally, barcodes systematically represented data by varying the widths and spacing’s of parallel lines. Now, you can generate and recognize barcodes with custom widths. The idea is to calculate the widths for all supported properties and generate a barcode that fits in the space left.
//your code here...// Code sample for creating an Image with Exact Barcode Only //[C# Code Sample] // Generate the barcode BarCodeBuilder builder = new BarCodeBuilder(); // Set symbology type builder.SymbologyType = Symbology.Code128; // Set the code text builder.CodeText = "123456"; // Get bitmap with exact barcode only Bitmap bmp = builder.GetOnlyBarCodeImage(); // Save image on local bmp.Save("c:\\barcode.png", ImageFormat.Png); //[VB.NET Code Sample] ' Generate the barcode Dim builder As New BarCodeBuilder() ' Set symbology type builder.SymbologyType = Symbology.Code128 ' Set the code text Dim codetext As String = "123456"; builder.CodeText = codetext ' Get bitmap with exact barcode only Dim bmp As Bitmap = builder.GetOnlyBarCodeImage() ' Save image on local bmp.Save("c:\\barcode.png") //Create and Set Size for Whole Picture With Barcode inside //[C# Code Sample] // Generate the barcode BarCodeBuilder builder = new BarCodeBuilder(); // Set symbology type builder.SymbologyType = Symbology.Pdf417; // Set the code text builder.CodeText = "One thing 2 thing"; // Set the code text location builder.CodeLocation = CodeLocation.None; // Set graphics unit builder.GraphicsUnit = GraphicsUnit.Pixel; // Set margins builder.Margins.Set(0); // Get Bitmap with exact barcode only Bitmap bmp = builder.GetOnlyBarCodeImage(); // Allows to set size for whole picture with barcode inside Bitmap tt = builder.GetCustomSizeBarCodeImage(new Size(bmp.Width * 5, bmp.Height * 5), false); // Save image on local tt.Save(@"c:\ab\v5.2\test20\barcode2.png", ImageFormat.Png); //[VB.NET Code Sample] ' Generate the barcode Dim builder As New BarCodeBuilder() ' Set symbology type builder.SymbologyType = Symbology.Pdf417 ' Set the code text builder.CodeText = "One thing 2 thing" ' Set the code text location builder.CodeLocation = CodeLocation.None ' Set graphics unit builder.GraphicsUnit = GraphicsUnit.Pixel ' Set margins builder.Margins.[Set](0) ' Get Bitmap with exact barcode only Dim bmp As Bitmap = builder.GetOnlyBarCodeImage() ' Allows to set size for whole picture with barcode inside Dim tt As Bitmap = builder.GetCustomSizeBarCodeImage(New Size(bmp.Width * 5, bmp.Height * 5), False) ' Save image on local tt.Save("c:\ab\v5.2\test20\barcode2.png", ImageFormat.Png)

Url: http://www.aspose.com/docs/display/barcodenet/Generate+Barcode+Using+Custom+Width+Support

Language: C# | User: Sheraz Khan | Created: Jun 17, 2015 | Tags: Create Image with Exact Barcode Create Image with Exact BarcodeCreate Size for Whole Picture With Barcode Create Size for Whole Picture With Barcode Set Size for Whole Picture With Barcode generate barcode using custom width recognizing the barcode .NET Barcode API