Esempio n. 1
0
        public string CreateBarCode(string data, string path)
        {
            string kq = "Thanh Cong";

            BarcodeLib.Barcode.Linear codabar = new BarcodeLib.Barcode.Linear();
            codabar.Type = BarcodeLib.Barcode.BarcodeType.CODABAR;
            codabar.Data = data;
            string imageFullPath = path;

            this.FullPath       = imageFullPath;
            codabar.UOM         = BarcodeLib.Barcode.UnitOfMeasure.PIXEL;
            codabar.BarColor    = System.Drawing.Color.Blue;
            codabar.BarWidth    = 2;
            codabar.LeftMargin  = 12;
            codabar.RightMargin = 12;
            codabar.drawBarcode(imageFullPath);
            string kt = "";

            try
            {
                string[] result = BarcodeLib.BarcodeReader.BarcodeReader.read(imageFullPath, BarcodeLib.BarcodeReader.BarcodeReader.CODABAR);
                kt = result[0];
                kq = imageFullPath;
                return(kq);
            }
            catch (IndexOutOfRangeException ex)
            {
                kq = "Wrong input";
                return(kq);
            }
        }
Esempio n. 2
0
        private void generateBarcode()
        {
            // Create an linear barcode object (BarcodeLib.Barcode.Linear)
            BarcodeLib.Barcode.Linear barcode = new BarcodeLib.Barcode.Linear();

            // Set barcode type to Code 39
            barcode.Type = BarcodeLib.Barcode.BarcodeType.CODE39;

            // Set your encoded barcode value
            barcode.Data = "123456789";

            // Other barcode settings
            // Save barcode image into your system

            // Draw barcode image into a PNG file
            pb_BarcodeImage.Image = barcode.drawBarcode();
        }