Example #1
0
        public Barcode(string data, TYPE iType)
        {
            this.RawData      = data;
            this.Encoded_Type = iType;
            switch (iType)
            {
            case TYPE.EAN13:
                ibarcode = new EAN13(data);
                country  = ((EAN_UPCBase)ibarcode).Country;
                break;

            case TYPE.EAN8:
                ibarcode = new EAN8(data);
                country  = ((EAN_UPCBase)ibarcode).Country;
                break;

            case TYPE.UPCA:
                ibarcode = new UPCA(data);
                break;

            case TYPE.UPCE:
                ibarcode = new UPCE(data);
                break;

            case TYPE.Interleaved2of5:
                ibarcode = new Interleaved2of5(data);
                break;

            case TYPE.ITF14:
                ibarcode = new ITF14(data);
                break;

            case TYPE.CODE128A:
                ibarcode = new Code128(data, CharSet.A);
                break;

            case TYPE.CODE128B:
                ibarcode = new Code128(data, CharSet.B);
                break;

            case TYPE.CODE128C:
                ibarcode = new Code128(data, CharSet.C);
                break;

            case TYPE.CODE128:
                ibarcode = new Code128(data, CharSet.Auto);
                break;

            case TYPE.GS1_128:
                ibarcode = new GS1_128(data);
                break;
            }
            RawData     = ibarcode.RawData;
            EncodeValue = ibarcode.GetEncode();
            SetFontSize(RawData);
        }
Example #2
0
File: UPCE_2.cs Project: ikvm/test
 public override char CalcCheckChar(char[] acText, int cc)
 {
     return(UPCE.s_CalcCheckChar(acText, cc));
 }
Example #3
0
File: UPCE_2.cs Project: ikvm/test
 public override CharDef CalcCharDef(CharDef[][] aaABC, byte[] aCharsetSel, char[] text, int ind)
 {
     return(UPCE.s_CalcCharDef(aaABC, aCharsetSel, text, ind));
 }
        }//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
Example #5
0
        private void btnImprimirCodigoBarras_Click(object sender, System.EventArgs e)
        {
            CodigoBarras codigoBarras;
            switch (cboCodigoBarras.SelectedIndex)
            {
                case 0: codigoBarras = new EAN8(); break;
                case 1: codigoBarras = new EAN13();break;
                case 2: codigoBarras = new CODABAR();break;
                case 3: codigoBarras = new CODE39();break;
                case 4: codigoBarras = new CODE93();break;
                case 5: codigoBarras = new CODE128();break;
                case 6: codigoBarras = new ISBN();break;
                case 7: codigoBarras = new ITF();break;
                case 8: codigoBarras = new MSI();break;
                case 9: codigoBarras = new PDF417();break;
                case 10: codigoBarras = new PLESSEY();break;
                case 11: codigoBarras = new UPCA();break;
                case 12: codigoBarras = new UPCE();break;
                default: codigoBarras = new EAN13();break;
            }

            codigoBarras.Codigo = txtCodigoBarras.Text;

            // fonte
            if (rbtFonteNormal.Checked)
            {
                codigoBarras.Fonte = CodigoBarras.FonteLegenda.Normal;
            }
            else
            {
                codigoBarras.Fonte = CodigoBarras.FonteLegenda.Condensada;
            }

            // largura das barras
            if (rbtFina.Checked)
            {
                codigoBarras.Largura = CodigoBarras.LarguraBarra.Fina;
            }
            else if(rbtMedia.Checked)
            {
                codigoBarras.Largura = CodigoBarras.LarguraBarra.Media;
            }
            else
            {
                codigoBarras.Largura = CodigoBarras.LarguraBarra.Grossa;
            }

            // posicao legenda
            if (rbtCaracteresAbaixoCodigo.Checked)
            {
                codigoBarras.Posicao = CodigoBarras.PosicaoLegenda.Abaixo;
            }
            else if(rbtCaracteresAcimaCodigo.Checked)
            {
                codigoBarras.Posicao = CodigoBarras.PosicaoLegenda.Acima;
            }
            else if(rbtCaracteresAcimaAbaixoCodigo.Checked)
            {
                codigoBarras.Posicao = CodigoBarras.PosicaoLegenda.AcimaAbaixo;
            }
            else
            {
                codigoBarras.Posicao = CodigoBarras.PosicaoLegenda.Nenhuma;
            }

            try
            {
                miniPrinter.Imprimir(codigoBarras);
            }
            catch (BematechException erro)
            {
                MessageBox.Show(erro.Message, "TestMiniPrinter", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #6
0
        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());
        }