public void Encode_NonAsciiCharacterInAsciiMode_ShouldThrowException() { Action action = () => Code39.Encode("Ć¹", false, true); action.Should().Throw <InvalidOperationException>() .WithMessage("Only ASCII strings can be encoded"); }
private void button1_Click(object sender, EventArgs e) { Code39 code = new Code39(); Bitmap map = code.CreateBarCode(this.txtOrgCode.Text.Trim()); this.panelCode39.CreateGraphics().DrawImage(map, 0, 0); }
public void PrintViewClient() { SystemConfig config = FT.Commons.Cache.StaticCacheManager.GetConfig <SystemConfig>(); Code39 code39 = new Code39(); code39.WidthCU = 2; code39.LineHeight = 20; try { this.Draw11String(name, new Point(config.LeftPoint + 5, config.TopPoint)); SizeF titleSize = MyGraphics.MeasureString("1", code39.titleFont); code39.Height = code39.topHeight + code39.LineHeight + (int)titleSize.Height;//å®ä¹å¾ēé«åŗ¦ Bitmap map = code39.CreateBarCode(this.idcard); string path = Application.StartupPath + "/tempcode39.jpg"; ImageHelper.SaveCoderPic(map, path); Image imagetest2 = Image.FromFile(path); Image imagetmp2 = new System.Drawing.Bitmap(imagetest2); MyGraphics.DrawImage(imagetmp2, config.LeftPoint, config.TopPoint + 20); imagetest2.Dispose(); File.Delete(path); imagetmp2.Dispose(); } catch (Exception ex) { //LogFactoryWrapper.Debug("ē±äŗčÆ件å·ē ęę±åļ¼äøęÆęcode39ē¼ē ļ¼"); } }
public Mostrar_codigo_form(Usuarios usuario) { InitializeComponent(); usuario_actual = usuario; label1.Text = usuario.usuario; label2.Text = new DAOTipo_usuario().GetTipo_Usuario(usuario.id_tipo_usuario).tipo_usuario; string contrasenia = new DAOClave_scaner().Getclave_scaner(usuario.id_usuario).contrasenia; label3.Text = contrasenia; textBox1.Text = contrasenia; Code39 code = new Code39(contrasenia); string pathString2 = @"c:\Codigos generados"; string nombreArchivo = Convert.ToString(usuario_actual.usuario); if (!System.IO.File.Exists(pathString2)) { System.IO.Directory.CreateDirectory(pathString2); //barcode.drawBarcode("c:\\Codigos generados" + "\\" + nombreArchivo + ".png"); code.Paint().Save("c:\\Codigos generados" + "\\" + nombreArchivo + ".png", ImageFormat.Png); codigo_picture.ImageLocation = "c:\\Codigos generados" + "\\" + nombreArchivo + ".png"; } else { // barcode.drawBarcode("c:\\Codigos generados" + "\\" + nombreArchivo + ".png"); code.Paint().Save("c:\\Codigos generados" + "\\" + nombreArchivo + ".png", ImageFormat.Png); codigo_picture.ImageLocation = "c:\\Codigos generados" + "\\" + nombreArchivo + ".png"; } }
public void Encode_UnderscoreInNonAsciiMode_ShouldThrowException() { Action action = () => Code39.Encode("_", false, false); action.Should().Throw <InvalidOperationException>() .WithMessage("Invalid data! Try full ASCII mode"); }
public void TestForm2() { var barcode = new Code39 { EncodeThis = "Hello World2!", Form = 2, HriPosition = HRIPositions.Below, }; var payload = barcode.Build(); Assert.NotNull(payload); Assert.IsNotEmpty(payload); var expected = new byte[] { 0x1D, 0x68, 0x64, // BarcodeDotHeight 0x1D, 0x77, 0x02, // BarcodeWidthMultiplier 0x1D, 0x48, 0x02, // HRI Position 0x1D, 0x66, 0x00, // BarcodeFont 0x1D, 0x6B, 0x45, // Code39 Form 2 (byte)barcode.EncodeThis.Length, (byte)'H', (byte)'e', (byte)'l', (byte)'l', (byte)'o', (byte)' ', (byte)'W', (byte)'o', (byte)'r', (byte)'l', (byte)'d', (byte)'2', (byte)'!', (byte)'\0', }; Assert.AreEqual(expected, payload); }
private void InitializeType() { IBarcode barcode; switch (_type) { case Type.Code128: barcode = new Code128(_data); break; case Type.Code128A: barcode = new Code128(_data, Code128.Code128Type.A); break; case Type.Code128B: barcode = new Code128(_data, Code128.Code128Type.B); break; case Type.Code128C: barcode = new Code128(_data, Code128.Code128Type.C); break; case Type.Code11: barcode = new Code11(_data); break; case Type.Code39: barcode = new Code39(_data); break; case Type.Code39E: barcode = new Code39(_data, true); break; case Type.Code93: barcode = new Code93(_data); break; case Type.EAN8: barcode = new EAN8(_data); break; case Type.EAN13: barcode = new EAN13(_data); break; case Type.Codabar: barcode = new Codabar(_data); break; default: barcode = new Code128(_data); break; } _encodedData = barcode.GetEncoding(); }
public void TestEmpty() { var barcode = new Code39 { EncodeThis = "" }; var payload = barcode.Build(); Assert.NotNull(payload); Assert.IsEmpty(payload); }
public void encode() { int check = 0; if (checkDigit == Barcodes.YesNoEnum.Yes) { check = 1; } if (barcodeType == BarcodeEnum.Code39) { Code39 barcode = new Code39(); encodedData = barcode.encode(data, check); humanText = barcode.getHumanText(); } }
private void InitializeType() { IBarcode barcode; switch (_type) { case Type.Code39: barcode = new Code39(_data); break; default: barcode = new Code39(_data); break; } _encodedData = barcode.GetEncoding(); }
public void Encode(bool includeChecksum, bool fullAsciiMode, string data, string testResult) { IBarcodeIntCS code = Code39.Encode(data, includeChecksum, fullAsciiMode); code.Bounds.X.Should().Be(testResult.Length); code.Bounds.Y.Should().Be(1); code.Metadata.CodeKind.Should().Be(BarcodeType.Code39); code.Metadata.Dimensions.Should().Be(1); string encoded = string.Empty; int i = 0; foreach (var r in testResult) { encoded += code.At(i++, 0) ? "1" : "0"; } encoded.Should().Be(testResult); }
private void generar_codigo_button_Click(object sender, EventArgs e) { guardar_button.Enabled = true; modificar_button.Enabled = false; generar_codigo_button.Enabled = false; Random random = new Random(); int codigo = random.Next(10000, 9999999); codigo_textbox.Text = Convert.ToString(codigo); Code39 code = new Code39(codigo_textbox.Text); // Create linear barcode object /* Linear barcode = new Linear(); * // Set barcode symbology type to Code-39 * barcode.Type = BarcodeType.CODE39; * // Set barcode data to encode * barcode.Data = codigo_textbox.Text; * // Set barcode bar width (X dimension) in pixel * barcode.X = 1; * // Set barcode bar height (Y dimension) in pixel * barcode.Y = 60;*/ string pathString2 = @"c:\Codigos generados"; string nombreArchivo = Convert.ToString(codigo); if (!System.IO.File.Exists(pathString2)) { System.IO.Directory.CreateDirectory(pathString2); //barcode.drawBarcode("c:\\Codigos generados" + "\\" + nombreArchivo + ".png"); code.Paint().Save("c:\\Codigos generados" + "\\" + nombreArchivo + ".png", ImageFormat.Png); codigo_picture.ImageLocation = "c:\\Codigos generados" + "\\" + nombreArchivo + ".png"; codigoActual.ruta = "c:\\Codigos generados" + "\\" + nombreArchivo + ".png"; } else { // barcode.drawBarcode("c:\\Codigos generados" + "\\" + nombreArchivo + ".png"); code.Paint().Save("c:\\Codigos generados" + "\\" + nombreArchivo + ".png", ImageFormat.Png); codigo_picture.ImageLocation = "c:\\Codigos generados" + "\\" + nombreArchivo + ".png"; codigoActual.ruta = "c:\\Codigos generados" + "\\" + nombreArchivo + ".png"; } descripcion_textbox.Enabled = true; guardar_button.Enabled = true; }
public static BitmapSource GetBarcodeToImage(string code, BarType type, BarcodeImageResolution resolution = BarcodeImageResolution.MediumLow, BarcodeHeight height = BarcodeHeight.Normal, DisplayCodeType displayText = DisplayCodeType.Center) { switch (type) { case BarType.Code39: Code39 m_code = new Code39(); m_code.BarcodeHeight = height; m_code.BarcodeImageResolution = resolution; m_code.DisplayCodeType = displayText; m_code.Code = code; return(m_code.CodeImage); case BarType.EAN13: return(null); default: return(null); } }
public void MostrarImagen(string contrasenia) { Code39 code = new Code39(contrasenia); string pathString2 = @"c:\Codigos generados"; string nombreArchivo = Convert.ToString(usuario_actual.Nombre); if (!System.IO.File.Exists(pathString2)) { System.IO.Directory.CreateDirectory(pathString2); //barcode.drawBarcode("c:\\Codigos generados" + "\\" + nombreArchivo + ".png"); code.Paint().Save("c:\\Codigos generados" + "\\" + nombreArchivo + ".png", ImageFormat.Png); codigo_picture.ImageLocation = "c:\\Codigos generados" + "\\" + nombreArchivo + ".png"; } else { // barcode.drawBarcode("c:\\Codigos generados" + "\\" + nombreArchivo + ".png"); code.Paint().Save("c:\\Codigos generados" + "\\" + nombreArchivo + ".png", ImageFormat.Png); codigo_picture.ImageLocation = "c:\\Codigos generados" + "\\" + nombreArchivo + ".png"; } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["KeyID"])) { KeyID = Request["KeyID"] + ""; } //DataTable lo = new Hi.BLL.DIS_OrderOut().GetList("", " isnull(o.dr,0)=0 and o.IsAudit<>3 and o.ID=" + KeyID); Code39 _Code39 = new Code39(); _Code39.Height = 60; _Code39.Magnify = 0.5; //_Code39.ViewFont = new Font("å¾®č½Æé é»", 11); System.Drawing.Image _CodeImage = _Code39.GetCodeImage(KeyID, Code39.Code39Model.Code39Normal, true, true); System.IO.MemoryStream _Stream = new System.IO.MemoryStream(); _CodeImage.Save(_Stream, System.Drawing.Imaging.ImageFormat.Jpeg); Response.ContentType = "image/jpeg"; Response.Clear(); Response.BufferOutput = true; Response.BinaryWrite(_Stream.GetBuffer()); Response.Flush(); }
private void InitializeType() { IBarcode barcode; switch (_type) { case Type.Code128: barcode = new Code128(_data); break; case Type.Code11: barcode = new Code11(_data); break; case Type.Code39: barcode = new Code39(_data); break; case Type.Code93: barcode = new Code93(_data); break; case Type.EAN8: barcode = new EAN8(_data); break; case Type.EAN13: barcode = new EAN13(_data); break; default: barcode = new Code128(_data); break; } _encodedData = barcode.GetEncoding(); }
public void Encode_Checksum() { IBarcodeIntCS code = Code39.Encode("5B79AN", true, true); code.Checksum.Should().Be('M'); }
/// <summary> /// ē“ę„ęå° /// </summary> public void PrintExcel(bool saveInk) { GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess(); if (!saveInk) { string strExcelTemplateFile = Application.StartupPath + "/template/" + "驾驶čÆē³čÆ·č”Ø"; strExcelTemplateFile += "-" + this.Student.LearnType + ".xlt"; //System.IO.Path.GetFullPath(@"驾驶čÆē³čÆ·č”Ø.xlt"); excel.Open(strExcelTemplateFile); }//ēØęØ”ęæę件 else { string strExcelTemplateFile = Application.StartupPath + "/template/" + "å„ę-驾驶čÆē³čÆ·č”Ø"; //System.IO.Path.GetFullPath(@"驾驶čÆē³čÆ·č”Ø.xlt"); strExcelTemplateFile += "-" + this.Student.LearnType + ".xlt"; excel.Open(strExcelTemplateFile); //excel.Open(); } excel.IsVisibledExcel = false; Code39 code39 = new Code39(); code39.WidthCU = 2; code39.LineHeight = 20; try { //SizeF titleSize = MyGraphics.MeasureString("1", code39.titleFont); code39.Height = code39.topHeight + code39.LineHeight + (int)20;//å®ä¹å¾ēé«åŗ¦ Bitmap map = code39.CreateBarCode(Student.IdCard); string pathcode39 = Application.StartupPath + "/tempcode39.jpg"; ImageHelper.SaveCoderPic(map, pathcode39); // map.Save(pathcode39, System.Drawing.Imaging.ImageFormat.Jpeg); excel.InsertPicture(3, 1, pathcode39, 155, 26, 0); } catch (Exception ex) { //LogFactoryWrapper.Debug("ē±äŗčÆ件å·ē ęę±åļ¼äøęÆęcode39ē¼ē ļ¼"); } //excel.SetCellText(1, 24, 1, 30, "é©¾ę ”ļ¼" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName); //excel.SetCellText(2, 24, 2, 30, "é©¾ę ”-" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName); // excel.SetCellText(1, 1, " " + this.name); // excel.SetCellText(1, 20, " " + this.name); //excel.SetCellText(1, 21, " " + this.name); CompanyInfo comp = StaticCacheManager.GetConfig <CompanyInfo>(); excel.SetCellText(1, 22, "é©¾ę ”ļ¼" + comp.NickName); //excel.SetCellText(1, 23, " " + this.name); // excel.SetCellText(2, 24, 2, 30, " " + this.name); excel.SetCellText(4, 3, 4, 11, " " + Student.Name); excel.SetCellText(4, 14, 4, 15, Student.Sex); excel.SetCellText(4, 19, 4, 24, Student.Birthday); excel.SetCellText(4, 27, 4, 30, Student.Nation); excel.SetCellText(5, 3, 5, 4, Student.IdCardType); if (Student.IdCardType.Length < IdCardTypeMaxLen) { excel.SetFont(5, 3, 6, 4, new Font("å®ä½", 15f)); } for (int i = 0; i < Student.IdCard.Length; i++) { excel.SetCellText(5, 7 + i, Student.IdCard[i].ToString()); } if (Student.TempId.Length > 0) { excel.SetCellText(6, 3, 6, 4, "ęä½čÆ"); for (int i = 0; i < Student.TempId.Length; i++) { excel.SetCellText(6, 7 + i, Student.TempId[i].ToString()); } } excel.SetCellText(7, 3, 7, 24, " " + Student.RegAddress); string connadd = this.GetConnAddress(); excel.SetCellText(8, 3, 8, 24, " " + connadd); if (connadd.Length < ConnAddressMaxLen) { excel.SetFont(8, 3, 8, 24, new Font("å®ä½", 15f)); } excel.SetCellText(9, 3, 9, 13, " " + Student.Phone); excel.SetCellText(9, 18, 9, 24, Student.PostCode); excel.SetCellText(10, 11, 10, 17, Student.NewCarType); DateTime regDate = System.DateTime.Now; if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.PrintApplyDate) { excel.SetCellText(35, 25, 36, 30, regDate.Year + " 幓 " + regDate.Month + " ę " + regDate.Day + "ę„"); } string path = Application.StartupPath + "/temp.jpg"; if (Student.LearnType == "åå¦") { if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.Allow2Dimension) { //this.GetQRImage(Student.Dimension).Save(path, System.Drawing.Imaging.ImageFormat.Jpeg); ImageHelper.SaveCoderPic(this.GetQRImage(Student.Dimension), path); //excel.InsertPicture(25, 23, path, 110, 110, 5); excel.InsertPicture(27, 16, path, 100, 100, 5); } } else { excel.SetCellText(10, 25, 10, 30, Student.OldCarType); if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.PrintProfile) { excel.SetCellText(3, 25, 3, 30, Student.Profile); } } /*if (this.LearnTypeString == "åå¦") * { * if (!this.saveInk) * { * excel.SetCellText(10, 3, "ā”åꬔē³é¢"); * } * else * { * excel.SetCellText(10, 3, "ā"); * } * * } * else * { * if (!this.saveInk) * { * excel.SetCellText(11, 3, "ā”å¢å åé©¾č½¦å"); * } * else * { * excel.SetCellText(11, 3, "ā"); * } * excel.SetCellText(10, 25, 10, 30, this.HaveCarType); * } */ GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>(); if (printSetting.PrintModel == "ē“ę„ę") { excel.Print(); } else { excel.PrintPreview(); } excel.Close(); }
}//Encode() /// <summary> /// Encodes the raw data into binary form representing bars and spaces. /// </summary> internal Image Encode() { DateTime dtStartTime = DateTime.Now; //make sure there is something to encode if (Raw_Data.Trim() == "") { throw new System.Exception("EENCODE-1: Input data not allowed to be blank."); } if (this.EncodedType == EncodingType.UNSPECIFIED) { throw new System.Exception("EENCODE-2: Symbology type not allowed to be unspecified."); } this.Encoded_Value = ""; this._Country_Assigning_Manufacturer_Code = "N/A"; IBarcode ibarcode; switch (this.Encoded_Type) { case EncodingType.UCC12: case EncodingType.UPCA: //Encode_UPCA(); ibarcode = new UPCA(Raw_Data); break; case EncodingType.UCC13: case EncodingType.EAN13: //Encode_EAN13(); ibarcode = new EAN13(Raw_Data); break; case EncodingType.Interleaved2of5: //Encode_Interleaved2of5(); ibarcode = new Interleaved2of5(Raw_Data); break; case EncodingType.Industrial2of5: case EncodingType.Standard2of5: //Encode_Standard2of5(); ibarcode = new Standard2of5(Raw_Data); break; case EncodingType.LOGMARS: case EncodingType.CODE39: //Encode_Code39(); ibarcode = new Code39(Raw_Data); break; case EncodingType.CODE39Extended: ibarcode = new Code39(Raw_Data, true); break; case EncodingType.Codabar: //Encode_Codabar(); ibarcode = new Codabar(Raw_Data); break; case EncodingType.PostNet: //Encode_PostNet(); ibarcode = new Postnet(Raw_Data); break; case EncodingType.ISBN: case EncodingType.BOOKLAND: //Encode_ISBN_Bookland(); ibarcode = new ISBN(Raw_Data); break; case EncodingType.JAN13: //Encode_JAN13(); ibarcode = new JAN13(Raw_Data); break; case EncodingType.UPC_SUPPLEMENTAL_2DIGIT: //Encode_UPCSupplemental_2(); ibarcode = new UPCSupplement2(Raw_Data); break; case EncodingType.MSI_Mod10: case EncodingType.MSI_2Mod10: case EncodingType.MSI_Mod11: case EncodingType.MSI_Mod11_Mod10: case EncodingType.Modified_Plessey: //Encode_MSI(); ibarcode = new MSI(Raw_Data, Encoded_Type); break; case EncodingType.UPC_SUPPLEMENTAL_5DIGIT: //Encode_UPCSupplemental_5(); ibarcode = new UPCSupplement5(Raw_Data); break; case EncodingType.UPCE: //Encode_UPCE(); ibarcode = new UPCE(Raw_Data); break; case EncodingType.EAN8: //Encode_EAN8(); ibarcode = new EAN8(Raw_Data); break; case EncodingType.USD8: case EncodingType.CODE11: //Encode_Code11(); ibarcode = new Code11(Raw_Data); break; case EncodingType.CODE128: //Encode_Code128(); ibarcode = new Code128(Raw_Data); break; case EncodingType.CODE128A: ibarcode = new Code128(Raw_Data, Code128.TYPES.A); break; case EncodingType.CODE128B: ibarcode = new Code128(Raw_Data, Code128.TYPES.B); break; case EncodingType.CODE128C: ibarcode = new Code128(Raw_Data, Code128.TYPES.C); break; case EncodingType.ITF14: ibarcode = new ITF14(Raw_Data); break; case EncodingType.CODE93: ibarcode = new Code93(Raw_Data); break; default: throw new System.Exception("EENCODE-2: Unsupported encoding type specified."); }//switch this.Encoded_Value = ibarcode.Encoded_Value; this.Raw_Data = ibarcode.RawData; this.Formatted_Data = ibarcode.FormattedData; this._EncodingTime = ((TimeSpan)(DateTime.Now - dtStartTime)).TotalMilliseconds; _Encoded_Image = (Image)Generate_Image(); _XML = GetXML(); return(EncodedImage); }//Encode
private void PrintApply() { ApplyPrinterConfig config = AllPrinterConfig.GetPrinterConfig().ApplyConfig; int height = (config.Down - config.Up) * BaseStudentPrinter.PixelUnit + 140; //int sep = 35; int sep = 31; // int width = 132; int width = (config.Right - config.Left) * BaseStudentPrinter.PixelUnit + 90; //16,2 //MyGraphics.DrawImage(this.GetQRImage(this.GetQRString()),new Point(620,860)); //14,2 if (Student.LearnType == "åå¦") { if (config.Allow2Dimension) { string path = Application.StartupPath + "/temp.jpg"; //string path = Application.StartupPath + "/tempcode39.jpg"; log.Debug("č¦ęå°äŗŗēå§åļ¼" + Student.Name); log.Debug("č¦ęå°äŗŗēčŗ«ä»½čÆå·ē ļ¼" + Student.IdCard); log.Debug("č¦ęå°äŗŗēäŗē»“ę”ē äæ”ęÆäøŗ:" + Student.Dimension); ImageHelper.SaveCoderPic(this.GetQRImage(Student.Dimension), path); // MyGraphics.DrawImage(Image.FromFile(path), new Rectangle(new Point(516 + width, 720 + height), new Size(150, 150))); Image imagetest = Image.FromFile(path); Image imagetmp = new System.Drawing.Bitmap(imagetest); MyGraphics.DrawImage(imagetest, new Rectangle(new Point(356 + width, 790 + height), new Size(130, 130))); imagetest.Dispose(); File.Delete(path); imagetmp.Dispose(); } } DateTime regDate = System.DateTime.Now; if (config.PrintApplyDate) { this.Draw10String(regDate.Year + " " + regDate.Month + " " + regDate.Day, new Point(width + 567, height + 920)); } //MyGraphics.DrawImage(this.GetQRImage(this.GetQRString()), new Point(320, 460)); //ē»åŗé©¾ę ”ē®ē§° //MyGraphics.DrawRectangle(blackPen, 600, 10, 680, 30); //this.DrawStringHor("é©¾ę ”ē®ē§°ļ¼" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName, new Point(605, 55)); // this.Draw11String("é©¾ę ”ē®ē§°ļ¼" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName, new Point(605,55)); CompanyInfo comp = StaticCacheManager.GetConfig <CompanyInfo>(); this.DrawStringHor("é©¾ę ”ļ¼" + comp.NickName, new Font("é»ä½", 15), new Point(480 + width - config.NameLeft * BaseStudentPrinter.PixelUnit, height - 120 + config.NameDown * BaseStudentPrinter.PixelUnit)); // ē»åŗčŗ«ä»½čÆęå·ē ēäøē»“ę”ē Code39 code39 = new Code39(); code39.WidthCU = 2; code39.LineHeight = 20; try { SizeF titleSize = MyGraphics.MeasureString("1", code39.titleFont); code39.Height = code39.topHeight + code39.LineHeight + (int)titleSize.Height;//å®ä¹å¾ēé«åŗ¦ Bitmap map = code39.CreateBarCode(Student.IdCard); string path = Application.StartupPath + "/tempcode39.jpg"; ImageHelper.SaveCoderPic(map, path); Image imagetest2 = Image.FromFile(path); Image imagetmp2 = new System.Drawing.Bitmap(imagetest2); MyGraphics.DrawImage(imagetmp2, new RectangleF(width - 40, height - 46, 240, 30)); imagetest2.Dispose(); File.Delete(path); imagetmp2.Dispose(); } catch (Exception ex) { //LogFactoryWrapper.Debug("ē±äŗčÆ件å·ē ęę±åļ¼äøęÆęcode39ē¼ē ļ¼"); } if (config.PrintProfile && Student.LearnType != "åå¦") { this.Draw15String(Student.Profile, new Point(width + 555, height - 34));//+75 } this.Draw15String(Student.Name, new Point(width, height));//+75 this.Draw15String(Student.Sex, new Point(319 + width, height)); this.Draw15String(Student.Birthday, new Point(width + 436, height)); this.Draw15String(Student.Nation, new Point(606 + width, height)); height += sep - 2; if (Student.IdCardType.Length < IdCardTypeMaxLen) { this.Draw15String(Student.IdCardType, new Point(width, height + 5)); } else { this.Draw9String(Student.IdCardType, new Point(width, height + 5)); } //ē»čŗ«ä»½čÆå·ē StringFormat stringFormat = new StringFormat(); stringFormat.LineAlignment = StringAlignment.Center; stringFormat.Alignment = StringAlignment.Center; for (int i = 0; i < Student.IdCard.Length; i++) { //MyGraphics.DrawString(idCard[i].ToString(), body11Font, blackBrush, new RectangleF(332 + 17 * i+(i/2)*1, height - 7, 17, 35), stringFormat); MyGraphics.DrawString(Student.IdCard[i].ToString(), body15Font, blackBrush, new RectangleF(width + 165 + 22 * i + (i / 6) * 1, height - 7, 22, 35), stringFormat); // MyGraphics.DrawRectangle(blackPen, 332 + 17 * i + (i / 2) * 1, height - 7, 17, 36); // this.Draw11String(idCard[i].ToString(), new Point(334 + i * tempIdSep, height)); } this.PrintSelfPhoto(); height += sep - 3; //ē»ęä½čÆę if (Student.TempId != null && Student.TempId != string.Empty) { this.Draw15String("ęä½čÆ", new Point(width, height + 5)); for (int i = 0; i < Student.TempId.Length; i++) { MyGraphics.DrawString(Student.TempId[i].ToString(), body15Font, blackBrush, new RectangleF(width + 165 + 21 * i + (i / 2) * 1, height - 5, 21, 35), stringFormat); } } height += sep + 5; //string connadd = this.GetConnAddress(); // string connadd = Student.RegAddress; string connadd = Student.ConnAddress; if (connadd.Length < ConnAddressMaxLen) { this.Draw15String(connadd, new Point(width, height)); } else { this.Draw12String(connadd, new Point(width, height)); } //this.Draw15String(Student.RegAddress, new Point(width, height)); height += sep + 5; this.Draw15String(Student.Phone, new Point(width, height)); this.Draw15String(Student.Description, new Point(410 + 100, height)); height += sep + 6; this.Draw15String(Student.Mobile, new Point(width, height)); this.Draw15String(Student.PostCode, new Point(410 + 100, height)); height += sep + 10; //this.Draw11String(this.allowCar, new Point(470, height)); this.Draw15String(Student.NewCarType, new Point(width + 170 + (config.CarRight - config.CarLeft) * BaseStudentPrinter.PixelUnit, (config.CarDown - config.CarUp) * BaseStudentPrinter.PixelUnit + height + 50)); //äøŗå¢é©¾ęč åå¦ęé© Font check = new Font("å®ä½", 20); if (Student.LearnType == "åå¦") { // this.Draw11String("ā", new Point(width+18, height+2)); this.DrawStringHor("ā", check, new Point(width - 58 + (config.GouDown - config.GouUp) * BaseStudentPrinter.PixelUnit, height - 5 + (config.GouRight - config.GouLeft) * BaseStudentPrinter.PixelUnit)); } else { //this.Draw11String("ā", new Point(width+18, height+sep-1)); this.DrawStringHor("ā", check, new Point(width - 58 + (config.GouDown - config.GouUp) * BaseStudentPrinter.PixelUnit, height + sep - 6 + (config.GouRight - config.GouLeft) * BaseStudentPrinter.PixelUnit)); //this.Draw15String(Student.OldCarType, new Point(568 + width, height)); } }
public void Test() { var code39 = new Code39(); using (var ms = new MemoryStream()) using (var bmp = code39.EncodeStandard("HELLO")) { bmp.Save(ms, ImageFormat.Png); this.TestContext.AddResult(ms, "code39.EncodeStandard.png"); } using (var ms = new MemoryStream()) using (var bmp = code39.EncodeFullAscii("Hello World!")) { bmp.Save(ms, ImageFormat.Png); this.TestContext.AddResult(ms, "code39.EncodeFullAscii.png"); } { var codes = new[] { "ABCDEFGHIJ", "KLMNOPQRST", "UVWXYZ0123", "456789 -$%", "./+", }; using (var ms = new MemoryStream()) using (var set = new Bitmap((codes[0].Length + 2) * 16, codes.Length * 16)) using (var graph = Graphics.FromImage(set)) { foreach (var item in codes.Select((v, i) => new { v, i })) { using (var bmp = code39.EncodeStandard(item.v)) { graph.DrawImage(bmp, new Point(0, item.i * 16)); } } set.Save(ms, ImageFormat.Png); this.TestContext.AddResult(ms, "code39.Test.png"); } } { var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -$%./+"; var codes = alphabet.Select(c => "" + c).ToArray(); using (var ms = new MemoryStream()) using (var set = new Bitmap(((codes[0].Length + 2) * 16) + 32, codes.Length * 16)) using (var graph = Graphics.FromImage(set)) { graph.FillRectangle(Brushes.White, 0, 0, set.Width, set.Height); foreach (var item in codes.Select((v, i) => new { v, i })) { using (var bmp = code39.EncodeStandard(item.v)) { graph.DrawString(item.v, SystemFonts.DefaultFont, Brushes.Black, new Point(0, item.i * 16)); graph.DrawImage(bmp, new Point(32, item.i * 16)); } } set.Save(ms, ImageFormat.Png); this.TestContext.AddResult(ms, "code39.Test2.png"); } } }
private void barcodePrintDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { var height = 87; var numberToPrint = (int)numericUpDownBarcode.Value; string code = deptSIDetailList[dgvDeptStockIn.CurrentRow.Index].Product.ProductId; if (numberToPrint > 3) { height = (numberToPrint / 3) * 87; numberToPrint = 3; } var eventArgs = new MainStockInEventArgs{ProductMasterIdForPrice = deptSIDetailList[dgvDeptStockIn.CurrentRow.Index].Product.ProductMaster.ProductMasterId}; EventUtility.fireEvent(GetPriceEvent, this, eventArgs); string titleString = ""; string name = deptSIDetailList[dgvDeptStockIn.CurrentRow.Index].Product.ProductMaster.ProductName; if (eventArgs.DepartmentPrice != null) { //titleString = name + " GiĆ” : " + eventArgs.DepartmentPrice.Price.ToString("#,##", CultureInfo.CreateSpecificCulture("de-DE")) ; titleString = name + " - " + eventArgs.DepartmentPrice.Price.ToString() + ".00 "; } var code39 = new Code39 { FontFamilyName = "3 of 9 Barcode", //2.FontFamilyName = "MW6 Code39MT", //3.FontFamilyName = "MW6 Code39S", //4.FontFamilyName = "MW6 Code39LT", //5.FontFamilyName = "Code EAN13", FontFileName = "Common\\3OF9_NEW.TTF", //2.FontFileName = "Common\\MW6Code39MT.TTF", //3.FontFileName = "Common\\MW6Code39S.TTF", //4.FontFileName = "Common\\MW6Code39LT.TTF", //5.FontFileName = "Common\\ean13.ttf", ShowCodeString = true, FontSize = 12, TitleFont = new Font("Tahoma", 12), CodeStringFont = new Font("Tahoma",12), Title = titleString + " VND" }; //barcodeControl1.BarcodeData = deptSIDetailList[dgvDeptStockIn.CurrentRow.Index].Product.ProductId; BarcodeLib.Barcode barcode = new Barcode(); string barCodeStr = deptSIDetailList[dgvDeptStockIn.CurrentRow.Index].Product.ProductId; Image imageBC = barcode.Encode(BarcodeLib.TYPE.CODE39, barCodeStr, Color.Black, Color.White, (int)(1.35 * e.Graphics.DpiX), (int)(0.45 * e.Graphics.DpiY)); /*var code39Gen = code39.GenerateBarcode(deptSIDetailList[dgvDeptStockIn.CurrentRow.Index].Product.ProductId, (int)((float)(1.5*e.Graphics.DpiX)),(int)((float)(0.75*e.Graphics.DpiY)));*/ Bitmap bitmap1 = new Bitmap(imageBC); bitmap1.SetResolution(204,204); /*Bitmap bitmap2 = new Bitmap(code39Gen); bitmap2.SetResolution(203,203);*/ e.Graphics.SmoothingMode = SmoothingMode.HighQuality; e.Graphics.CompositingQuality = CompositingQuality.HighQuality; // draw title string // calculate scale for title var titleStrSize = e.Graphics.MeasureString(titleString.PadRight(25), new Font("Arial",10)); float currTitleSize = new Font("Arial",10).Size; float scaledTitleSize = (150 * currTitleSize) / titleStrSize.Width; //Font _titleFont = new Font("Arial", scaledTitleSize); Font _titleFont = new Font("Arial", 7); string nameString = titleString.Substring(0, titleString.IndexOf(" - ")); string priceString = titleString.Substring(titleString.IndexOf(" - ")); var priceTotalSize = e.Graphics.MeasureString(titleString, _titleFont); var nameSize = e.Graphics.MeasureString(nameString, _titleFont); var priceSize = e.Graphics.MeasureString(priceString, _titleFont); var barCodeSize = e.Graphics.MeasureString(barCodeStr, _titleFont); /*Bitmap bitmapName = new Bitmap(nameString, true); Bitmap bitmapPrice = new Bitmap(priceString, true);*/ for (int i = 0; i < numberToPrint; i++) { System.Drawing.Rectangle rc = new System.Drawing.Rectangle((i % 3) * 135, 50, (int)(1.4 * 100), (int)(0.4 * 100)); //(i % 3) * 124, (i / 3) * 87, 117, 79 /*e.Graphics.DrawString(nameString, _titleFont, new SolidBrush(Color.Black), (i % 3) * 135 + XCentered(nameSize.Width, 140), 25); e.Graphics.DrawString(priceString, _titleFont, new SolidBrush(Color.Black), (i % 3) * 135 + XCentered(priceSize.Width, 140), (float)22.5 + nameSize.Height);*/ e.Graphics.DrawString(titleString, _titleFont, new SolidBrush(Color.Black), (i % 3) * 140 + XCentered(priceTotalSize.Width, 140), (float)25); e.Graphics.DrawImage(bitmap1, new Rectangle((i % 3) * 140 + (int)XCentered((float)(1.35 * 100), 140), (int)(25 + priceTotalSize.Height), (int)(1.35 * 100), (int)(0.45 * 100))); e.Graphics.DrawString(barCodeStr, _titleFont, new SolidBrush(Color.Black), (i % 3) * 140 + XCentered(barCodeSize.Width, 140), (float)88); //e.Graphics.DrawImage(barcodeControl1.GetMetaFile(), new Rectangle((i % 3) * 135, 120, (i % 3) * 135 + (int)(1.4 * 100), (int)(0.75 * 100))); } }
private void GenerarCodigos_button_Click(object sender, EventArgs e) { //Creo una lista de todos los alumnos para realizar el codig //Genero el codigo dentro de un foreach //Contenido dentro de foreach List <DTOAlumnos> alumnos = new List <DTOAlumnos>(); alumnos = new DAOAlumnos().GetAlumnos(); foreach (DTOAlumnos lista in alumnos) { Code39 code = new Code39(lista.codigo); string pathString2 = @"c:\Codigos generados"; string nombreArchivo = lista.codigo + "-" + lista.Nombre + "-" + lista.catecismo + "-" + lista.grado; if (!System.IO.File.Exists(pathString2)) { System.IO.Directory.CreateDirectory(pathString2); code.Paint().Save("c:\\Codigos generados" + "\\" + nombreArchivo + ".png", ImageFormat.Png); // Load the image. //System.Drawing.Image image1 = System.Drawing.Image.FromFile(@"C:\Codigos generados"+ "\\" + nombreArchivo + ".png"); // Save the image in JPEG format. //image1.Save(@"C:\Codigos generados" + "\\" + nombreArchivo + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); // Image img = Image.FromFile("c:\\Codigos generados" + "\\" + nombreArchivo + ".png"); // img.Save("c:\\Codigos generados2" + "\\" + nombreArchivo + "2" + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); // Bitmap customImage = new Bitmap(@"c:\\Codigos generados" + "\\" + nombreArchivo + ".png"); // transformacionesElementales elementales = new transformacionesElementales(customImage); //elementales.descomponerRGB(); // elementales.binarizacion(128); //elementales.componerRGB(); // Graphics g = Graphics.FromImage(customImage); //g.DrawImage(customImage, 0, 0, customImage.Width, customImage.Height); //customImage.MakeTransparent(); //g.DrawImage(customImage, customImage.Width, 0, //customImage.Width, customImage.Height); //customImage.Save("c:\\Codigos generados" + "\\" + nombreArchivo + "MOD" + ".png"); //g.DrawString(lista.Nombre, new Font("Verdana", 12, GraphicsUnit.Pixel), new SolidBrush(Color.Red), 10, 90); //elementales.getMapa().Save("c:\\Codigos generados" + "\\" + nombreArchivo+"2"+ ".png"); } else { code.Paint().Save("c:\\Codigos generados" + "\\" + nombreArchivo + ".png", ImageFormat.Png); // Load the image. //System.Drawing.Image image1 = System.Drawing.Image.FromFile(@"C:\Codigos generados" + "\\" + nombreArchivo + ".png"); // Save the image in JPEG format. //image1.Save(@"C:\Codigos generados" + "\\" + nombreArchivo + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); // Image img = Image.FromFile("c:\\Codigos generados" + "\\" + nombreArchivo + ".png"); // img.Save("c:\\Codigos generados2" + "\\" + nombreArchivo + "2"+".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); // Bitmap customImage = new Bitmap(@"c:\\Codigos generados" + "\\" + nombreArchivo + ".png"); // transformacionesElementales elementales = new transformacionesElementales(customImage); //elementales.descomponerRGB(); // elementales.binarizacion(128); //elementales.componerRGB(); /*Graphics g = Graphics.FromImage(customImage); * g.DrawImage(customImage, 0, 0, customImage.Width, customImage.Height); * customImage.MakeTransparent(); * g.DrawImage(customImage, customImage.Width, 0, * customImage.Width, customImage.Height); * customImage.Save("c:\\Codigos generados" + "\\" + nombreArchivo + "MOD" + ".png");*/ //Graphics g = Graphics.FromImage(elementales.getMapa()); //g.DrawString(lista.Nombre, new Font("Verdana", 12, GraphicsUnit.Pixel), new SolidBrush(Color.Red), 10, 90); //elementales.getMapa().Save("c:\\Codigos generados" + "\\" + nombreArchivo+"2"+ ".png"); } } }
public void Encode_UnderscoreInAsciiMode_ShouldNotThrowException() { Action action = () => Code39.Encode("_", false, true); action.Should().NotThrow(); }
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length) { // Set the text to encode and the encoding type String toEncode = ((BarcodeConfigToken)parameters).TextToEncode; int encoding = ((BarcodeConfigToken)parameters).EncodingType; BarcodeSurface barcode = null; Rectangle selection = this.EnvironmentParameters.GetSelection(srcArgs.Surface.Bounds).GetBoundsInt(); ColorBgra primary = this.EnvironmentParameters.PrimaryColor; ColorBgra secondary = this.EnvironmentParameters.SecondaryColor; if (encoding == Barcode.CODE_39) { Code39 code39 = new Code39(); barcode = code39.CreateCode39(selection, srcArgs.Surface, toEncode, primary, secondary); } else if (encoding == Barcode.CODE_39_MOD_43) { Code39 code39 = new Code39(); barcode = code39.CreateCode39mod43(selection, srcArgs.Surface, toEncode, primary, secondary); } else if (encoding == Barcode.FULL_ASCII_CODE_39) { Code39 code39 = new Code39(); barcode = code39.CreateFullAsciiCode39(selection, srcArgs.Surface, toEncode, primary, secondary); } else if (encoding == Barcode.POSTNET) { Postnet postnet = new Postnet(); barcode = postnet.Create(selection, srcArgs.Surface, toEncode, primary, secondary); } for (int i = startIndex; i < startIndex + length; ++i) { Rectangle rect = rois[i]; for (int y = rect.Top; y < rect.Bottom; ++y) { for (int x = rect.Left; x < rect.Right; ++x) { dstArgs.Surface[x, y] = barcode[x,y]; } } } }
private static void TesteCodigoBarras() { using (var printer = new GenericPrinter(PortaCom)) { //Code128 Code128 code = new Code128() { EncodeThis = "12321321312", BarcodeWidthMultiplier = 2, BarcodeDotHeight = 50, //Autura do codigo HriPosition = Printer.Barcodes.Enums.HRIPositions.Below, Mode = Code128.Modes.A, BarcodeFont = ThermalFontsEnum.A }; printer.PrintASCIIString("Code 128 - Altura 50"); printer.FormFeed(1); printer.PrintBarCode(code); printer.FormFeed(1); printer.Reinitialize(); //Code39 Code39 code39 = new Code39() { EncodeThis = "12321321312", BarcodeWidthMultiplier = 2, BarcodeDotHeight = 30, //Autura do codigo BarcodeFont = ThermalFontsEnum.A }; printer.PrintASCIIString("Code 39 - Altura 30"); printer.FormFeed(1); printer.PrintBarCode(code); printer.FormFeed(1); printer.Reinitialize(); //ITF ITF itf = new ITF() { EncodeThis = "12321321312", BarcodeDotHeight = 100, //Autura do codigo BarcodeWidthMultiplier = 2, BarcodeFont = ThermalFontsEnum.A }; printer.PrintASCIIString("ITF - Altura 100"); printer.FormFeed(1); printer.PrintBarCode(code); printer.FormFeed(3); printer.Reinitialize(); //NFCe printer.PrintASCIIString("Exemplo QRCode NFCe\n"); var qrCodeNFCe = new QrCode(4, "http://www.sefaz.mt.gov.br/nfce/consultanfce?chNFe=51131003460900000290650010000000031000000031&nVersao=100&tpAmb=2&cDest=02801244147&dhEmi=323031332D31302D32345431363A32313A30332D30333A3030&vNF=1,00&vICMS=0,00&digVal=78764D34764E2B48586A735657516F653474415A547855547764383D&cIdToken=000001&cHashQRCode=7AF4285DA2D18133BEF9F9370AD4A185B2527AFB"); printer.PrintBarCode(qrCodeNFCe); printer.FormFeed(1); printer.Reinitialize(); //Sat printer.PrintASCIIString("Exemplo QRCode SAT\n"); var qrCodeSat = new QrCode(4, "http://www.sefaz.mt.gov.br/nfce/consultanfce?chNFe=51131003460900000290650010000000031000000031&nVersao=100&tpAmb=2&cDest=02801244147&dhEmi=323031332D31302D32345431363A32313A30332D30333A3030&vNF=1,00&vICMS=0,00&digVal=78764D34764E2B48586A735657516F653474415A547855547764383D&cIdToken=000001&cHashQRCode=7AF4285DA2D18133BEF9F9370AD4A185B2527AFB"); printer.PrintBarCode(qrCodeNFCe); printer.FormFeed(1); printer.Cut(CutModeEnum.Parcial); printer.Reinitialize(); } }
private void button1_Click(object sender, EventArgs e) { if (comboBox1.Text == "Code128") { Code128 bc = new Code128(); int i; bc.BarcodeSubtype = (Code128Subtype)Enum.Parse(typeof(Code128Subtype), comboBox2.Text); int.TryParse(textBox3.Text, out i); bc.Height = i; int.TryParse(textBox2.Text, out i); bc.ModuleWidth = i; bc.TextAbove = checkBox2.Checked; bc.DisplayText = checkBox1.Checked; int.TryParse(textBox4.Text, out i); bc.RotationAngle = i; try { if (checkBox3.Checked) { try { string line; System.IO.StreamReader file = new System.IO.StreamReader(textBox5.Text); while ((line = file.ReadLine()) != null) { bc.SaveBarcodeToFile(line, String.Format("{0}\\{1}.{2}", Path.GetDirectoryName(textBox5.Text), line, "gif")); } file.Close(); } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); } } else { pictureBox1.Image = bc.GetBarcodeImage(textBox1.Text); bc.SaveBarcodeToFile(textBox1.Text, @"C:\Temp\BC.gif"); } } catch (Exception) { } } ; if (comboBox1.Text == "Code39") { Code39 bc = new Code39(); int i; int.TryParse(textBox3.Text, out i); bc.Height = i; int.TryParse(textBox2.Text, out i); bc.ModuleWidth = i; bc.TextAbove = checkBox2.Checked; bc.DisplayText = checkBox1.Checked; int.TryParse(textBox4.Text, out i); bc.RotationAngle = i; pictureBox1.Image = bc.GetBarcodeImage(textBox1.Text); bc.SaveBarcodeToFile(textBox1.Text, @"C:\Temp\BC.gif"); } if (comboBox1.Text == "PDF417") { PDF417 bc = new PDF417(); int i; int.TryParse(textBox2.Text, out i); bc.ModuleWidth = i; int.TryParse(textBox4.Text, out i); bc.RotationAngle = i; pictureBox1.Image = bc.GetBarcodeImage(textBox1.Text); bc.SaveBarcodeToFile(textBox1.Text, @"C:\Temp\BC.gif"); } if (comboBox1.Text == "QRCode") { QRCode bc = new QRCode(); int i; int.TryParse(textBox2.Text, out i); bc.ModuleWidth = i; //int.TryParse(textBox4.Text, out i); bc.RotationAngle = i; int.TryParse(textBox4.Text, out i); bc.ErrorCorrectionLevel = i; pictureBox1.Image = bc.GetBarcodeImage(textBox1.Text); bc.SaveBarcodeToFile(textBox1.Text, @"C:\Temp\BC.gif"); } if (comboBox1.Text == "DataMatrix") { DataMatrix bc = new DataMatrix(); int i; int.TryParse(textBox2.Text, out i); bc.ModuleWidth = i; //int.TryParse(textBox4.Text, out i); bc.RotationAngle = i; //int.TryParse(textBox4.Text, out i); bc.ErrorCorrectionLevel = i; pictureBox1.Image = bc.GetBarcodeImage(textBox1.Text); bc.SaveBarcodeToFile(textBox1.Text, @"C:\Temp\BC.gif"); } //BarcodeGenerator BCG = new BarcodeGenerator(); //BCG.BarcodeType = BarcodeType.Code39; //pictureBox1.Image = BCG.GetBarcodeImage(textBox1.Text); //textBox2.Text = BCG.TextWidth.ToString(); //MessageBox.Show(NumberFormatInfo.CurrentInfo.PerMilleSymbol); //MessageBox.Show(NumberFormatInfo.CurrentInfo.NegativeInfinitySymbol); //MessageBox.Show((-1).ToString("x")); }
private static string GetSymbology(string Data, Enums.Type EncodingType) { ISymbology SymbologyUsing = null; switch (EncodingType) { case Enums.Type.UCC12: case Enums.Type.UPCA: SymbologyUsing = new UPCA(Data); break; case Enums.Type.UCC13: case Enums.Type.EAN13: SymbologyUsing = new EAN13(Data); break; case Enums.Type.Interleaved2of5: SymbologyUsing = new Interleaved2of5(Data); break; case Enums.Type.Industrial2of5: case Enums.Type.Standard2of5: SymbologyUsing = new Standard2of5(Data); break; case Enums.Type.LOGMARS: case Enums.Type.CODE39: SymbologyUsing = new Code39(Data); break; case Enums.Type.CODE39Extended: SymbologyUsing = new Code39(Data); break; case Enums.Type.Codabar: SymbologyUsing = new Codabar(Data); break; case Enums.Type.PostNet: SymbologyUsing = new Postnet(Data); break; case Enums.Type.ISBN: case Enums.Type.BOOKLAND: SymbologyUsing = new ISBN(Data); break; case Enums.Type.JAN13: SymbologyUsing = new JAN13(Data); break; case Enums.Type.UPC_SUPPLEMENTAL_2DIGIT: SymbologyUsing = new UPCSupplement2(Data); break; case Enums.Type.MSI_Mod10: case Enums.Type.MSI_2Mod10: case Enums.Type.MSI_Mod11: case Enums.Type.MSI_Mod11_Mod10: case Enums.Type.Modified_Plessey: SymbologyUsing = new MSI(Data); break; case Enums.Type.UPC_SUPPLEMENTAL_5DIGIT: SymbologyUsing = new UPCSupplement5(Data); break; case Enums.Type.UPCE: SymbologyUsing = new UPCE(Data); break; case Enums.Type.EAN8: SymbologyUsing = new EAN8(Data); break; case Enums.Type.USD8: case Enums.Type.CODE11: SymbologyUsing = new Code11(Data); break; case Enums.Type.CODE128: SymbologyUsing = new Code128(Data); break; case Enums.Type.CODE128A: SymbologyUsing = new Code128A(Data); break; case Enums.Type.CODE128B: SymbologyUsing = new Code128B(Data); break; case Enums.Type.CODE128C: SymbologyUsing = new Code128C(Data); break; case Enums.Type.ITF14: SymbologyUsing = new ITF14(Data); break; case Enums.Type.CODE93: SymbologyUsing = new Code93(Data); break; case Enums.Type.TELEPEN: SymbologyUsing = new Telepen(Data); break; } return(SymbologyUsing.Encode()); }