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); } }
public void WyswietlKod() { PictureBoxKod.Image = ean13.drawBarcode(); Graphics graphics = Graphics.FromImage(PictureBoxKod.Image); Font font = new Font("TimesNewRoman", 10, FontStyle.Bold, GraphicsUnit.Pixel); graphics.DrawString(informacjanadkodem, font, Brushes.Black, new Point(0, 0)); }
public void NamalujKody() { Font font = new Font("TimesNewRoman", 10, FontStyle.Bold, GraphicsUnit.Pixel); Graphics graphics; PictureBoxKodEanJeden.Image = ean13jeden.drawBarcode(); graphics = Graphics.FromImage(PictureBoxKodEanJeden.Image); graphics.DrawString(danezpliku[1], font, Brushes.Black, new Point(0, 0)); PictureBoxKodEanDwa.Image = ean13dwa.drawBarcode(); graphics = Graphics.FromImage(PictureBoxKodEanDwa.Image); graphics.DrawString(danezpliku[3], font, Brushes.Black, new Point(0, 0)); PictureBoxKodLokalizacja.Image = lokalizacja.drawBarcode(); graphics = Graphics.FromImage(PictureBoxKodLokalizacja.Image); graphics.DrawString(danezpliku[6], font, Brushes.Black, new Point(0, 0)); PictureBoxKodZlecenie.Image = zlecenie.drawBarcode(); graphics = Graphics.FromImage(PictureBoxKodZlecenie.Image); graphics.DrawString(danezpliku[9], font, Brushes.Black, new Point(0, 0)); PictureBoxKodWZ.Image = wz.drawBarcode(); graphics = Graphics.FromImage(PictureBoxKodWZ.Image); graphics.DrawString(danezpliku[12], font, Brushes.Black, new Point(0, 0)); PictureBoxKodPojemnik.Image = pojemnik.drawBarcode(); graphics = Graphics.FromImage(PictureBoxKodPojemnik.Image); graphics.DrawString(danezpliku[15], font, Brushes.Black, new Point(0, 0)); PictureBoxKodUser1.Image = userjeden.drawBarcode(); graphics = Graphics.FromImage(PictureBoxKodUser1.Image); graphics.DrawString(danezpliku[18], font, Brushes.Black, new Point(0, 0)); PictureBoxKodUser2.Image = userdwa.drawBarcode(); graphics = Graphics.FromImage(PictureBoxKodUser2.Image); graphics.DrawString(danezpliku[20], font, Brushes.Black, new Point(0, 0)); PictureBoxEan128Jeden.Image = ean128jeden.drawBarcode(); graphics = Graphics.FromImage(PictureBoxEan128Jeden.Image); graphics.DrawString(danezpliku[23], font, Brushes.Black, new Point(0, 0)); PictureBoxEan128Dwa.Image = ean128dwa.drawBarcode(); graphics = Graphics.FromImage(PictureBoxEan128Dwa.Image); graphics.DrawString(danezpliku[25], font, Brushes.Black, new Point(0, 0)); }
protected void Page_Load(object sender, EventArgs e) { GenerateOptionFigureTypes(false); Bcode.Type = BarcodeLib.Barcode.BarcodeType.CODE39; Bcode.ShowStartStopChar = false; Bcode.BarWidth = 1; Bcode.BarHeight = 50; Bcode.LeftMargin = 5; Bcode.RightMargin = 5; Bcode.TopMargin = 5; Bcode.BottomMargin = 5; Bcode.Data = TestCodeData; using (Bitmap bitMap = Bcode.drawBarcode()) { using (MemoryStream ms = new MemoryStream()) { bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png); byte[] byteImage = ms.ToArray(); //barcode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage); } } Questions = new DataBase.Questions(TestCodeData); // Objectives = new DataBase.ObjectivesObj(TestCode); if (ViewState["Questionaire"] == null) { ViewState["Questionaire"] = "none"; } if (ViewState["QuestObjectives"] == null) { ViewState["QuestObjectives"] = new object[] { }; } if (ViewState["Section"] == null) { ViewState.Add("Section", 0); } CurrentNumber = Convert.ToInt32(ViewState["QNumber"]); if (IsPostBack) { if (ViewState["ObjectivesCount"] == null) { ViewState.Add("ObjectivesCount", 1); } CurrentNumber = Convert.ToInt32(ViewState["QNumber"]); if (Convert.ToInt32(ViewState["Section"]) == 0) { SectionNumber = 1; } else { SectionNumber = 2; } System.Diagnostics.Debug.WriteLine(ViewState["Section"]); } else { if (ViewState["QNumber"] == null) { ViewState["QNumber"] = 1; CurrentNumber = Convert.ToInt32(ViewState["QNumber"]); } if (Convert.ToInt32(ViewState["Section"]) == 0) { SectionNumber = 1; } else { SectionNumber = 2; } LoadData(CurrentNumber, SectionNumber); } }
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(); }