To meet allthe requirements of applicationssituation, we provide flexible methods to create Code128: to Bitmap object, to file on the disk, to Stream object and to byte array. In this sample, we will introduce you how to generate Code128 and render it to the local file using C# language.
using System; using System.Drawing; using System.Drawing.Imaging; usingPQScan.BarcodeCreator; namespaceCode128GeneratorInCSharp { classProgram { staticvoid Main(string[] args) { //Create an instance of PQScan.BarcodeCreator.Barcodeobject. Barcode code128 = new Barcode(); //Set barcode date to encode code128.Data = "123456789"; //Set barcode type code128.BarType = BarCodeType.Code128; //Set barcode image width code128.Width = 300; //Set barcode image height code128.Height = 100; //Set 1d barcode human-readable text to display code128.ShowText = true; //Set barcode image foregroud color code128.BarcodeColor = Color.Black; //Set barcode image back ground color code128.BackgroundColor = Color.White; //Set barcode image format code128.PictureFormat = ImageFormat.Jpeg; //Save barcode image to file code128.CreateBarcode("code128-csharp.jpg"); } } }