Example #1
0
        public int Print(int PageNumber)
        {
            int    num      = 1;
            string szString = "";

            for (int i = 0; i < PageNumber; i++)
            {
                if (!this.LoadBarFontName.Equals("1"))
                {
                    num = 2;
                }
                try
                {
                    for (int j = 0; j < this.WindowsArrList.Count; j++)
                    {
                        Character character = null;
                        character = (Character)this.WindowsArrList[j];
                        String chnstr   = character.printData;
                        String fontname = character.SysFontName;
                        String chnname  = character.ID;
                        this.nCount = GETFONTHEX(chnstr, fontname, character.Orientation, character.Height, character.Width, character.c1, character.Itailc, this.cBuf);
                        IntPtr pBytes = Marshal.StringToCoTaskMemAnsi(this.cBuf.ToString());
                        RawPrinterHelper.SendBytesToPrinter(this.LabelPrinterName.ToString(), pBytes, this.nCount);
                    }
                    for (int k = 0; k < this.WindowsArrList.Count; k++)
                    {
                        Character character2 = null;
                        character2 = (Character)this.WindowsArrList[k];
                        szString   = string.Concat(new object[] { szString, "^FO", character2.pLeft.ToString(), ", ", character2.pTop.ToString(), "^XGOUTSTR01", ",", character2.XZoom.ToString(), ",", character2.YZoom.ToString(), "^FS" });
                    }
                    for (int m = 0; m < this.BarCodeArrList.Count; m++)
                    {
                        BarCode code = (BarCode)this.BarCodeArrList[m];
                        szString = szString + code.barcode;
                    }
                    szString = "^XA" + szString + "^XZ";
                    if (RawPrinterHelper.SendStringToPrinter(this.LabelPrinterName.ToString(), szString))
                    {
                        num = 0;
                    }
                }
                catch (Exception exception)
                {
                    exception.Message.ToString();
                    num = 3;
                }
            }
            return(num);
        }
Example #2
0
        // Methods
        //获取条码

        public void addBarCode(int pLeft, int pTop, string Data, int FontHigh, string BarFontName, string ShowData, string Above, int Orientation, string CheckDigit, int pZoom)
        {
            BarCode code = new BarCode(pLeft, pTop, Data, FontHigh, BarFontName, ShowData, Above, Orientation, CheckDigit, pZoom);

            this.BarCodeArrList.Add(code);
        }