首页 新闻 会员 周边 捐助

C#怎么向网络打印机发送指令(北洋98NP)

0
悬赏园豆:15 [待解决问题]

C#怎么向网络打印机发送指令(北洋98NP),如发送指令1D610F到打印机,知道的,写个简单的代码demo,谢谢

翱翔NET的主页 翱翔NET | 初学一级 | 园豆:35
提问于:2013-01-01 23:03
< >
分享
所有回答(2)
0

建议找找该打印机相关的说明书或文档吧

I,Robot | 园豆:9783 (大侠五级) | 2013-01-02 14:59
0

北洋的机器,不太了解,可以打80……电话
Intermec的机器,在C#当中 使用USB发送指令

 /// <summary>
        /// 用USB打印条码标签
        /// </summary>
        /// <param name="reco">
        /// reco[0]:条码,
        /// reco[1]:产品编码,
        /// reco[2]:产品名称,
        /// reco[3]:供应商,
        /// reco[4]:批号,
        /// reco[5]:打印数量
        /// </param>
        /// <param name="PrintName">打印机名字</param>
        /// <returns></returns>
        public static string UsbPrint(string[] reco, string PrintName)
        {
            try
            {
                #region

                string print = "NEW" + (char)13;
                print += "OPEN " + "\"" + "tmp:setup.sys" + "\"" + " FOR OUTPUT AS #1" + (char)13;  //编码
                print += "PRINT#1, " + "\"" + "MEDIA,MEDIA SIZE,XSTART,0" + "\"" + (char)13;

                //下面三行是热敏模式
                //print += "PRINT#1, " + "\"" + "MEDIA,PAPER TYPE,DIRECT THERMAL" + "\"" + (char)13;
                //print += "PRINT#1, " + "\"" + "MEDIA,PAPER TYPE,DIRECT THERMAL,LABEL CONSTANT,110" + "\"" + (char)13;
                //print += "PRINT#1, " + "\"" + "MEDIA,PAPER TYPE,DIRECT THERMAL,LABEL FACTOR,50" + "\"" + (char)13;
                //下面三行是热转移模式
                print += "PRINT#1, " + "\"" + "MEDIA,PAPER TYPE,TRANSFER" + "\"" + (char)13;
                print += "PRINT#1, " + "\"" + "MEDIA,PAPER TYPE,TRANSFER,RIBBON CONSTANT,100" + "\"" + (char)13;
                print += "PRINT#1, " + "\"" + "MEDIA,PAPER TYPE,TRANSFER,RIBBON FACTOR,25" + "\"" + (char)13;

                //设置标签纸张类型为中间有Gap间距的标签纸
                print += "PRINT#1, " + "\"" + "MEDIA,MEDIA TYPE,LABEL (w GAPS)" + "\"" + (char)13;
                print += "PRINT#1, " + "\"" + "FEEDADJ,STARTADJ,-144" + "\"" + (char)13;//
                print += "PRINT#1, " + "\"" + "FEEDADJ,STOPADJ,0" + "\"" + (char)13;//
                print += "PRINT#1, " + "\"" + "MEDIA,MEDIA SIZE,WIDTH,1024" + "\"" + (char)13;//宽 203dpi分辨率下,1mm=8dot
                print += "PRINT#1, " + "\"" + "MEDIA,MEDIA SIZE,LENGTH,420" + "\"" + (char)13;//高 毫米
                print += "PRINT#1, " + "\"" + "MEDIA,CONTRAST,+0%" + "\"" + (char)13;//墨色深度
                print += "PRINT#1, " + "\"" + "PRINT DEFS,PRINT SPEED,80" + "\"" + (char)13;//速度
                print += "CLOSE #1" + (char)13;
                print += "SETUP  " + "\"" + "tmp:setup.sys" + "\"" + (char)13;//速度
                print += "KILL  " + "\"" + "tmp:setup.sys" + "\"" + (char)13;//速度


                print += "CLL" + (char)13;
                print += "NASC 1" + (char)13;
                print += "NASCD " + "\"" + "utf-8" + "\"" + (char)13;  //编码
                print += "NASCD " + "\"" + "card1:GB2312.NCD" + "\"" + (char)13;
                print += "FONTD " + "\"" + "SimHei" + "\"" + ",12,0,100" + (char)13;   //字体,字号,倾斜,字距
                //print += "FT " + "\"" + "Dutch 801 Bold BT" + "\"" + (char)13;
                #endregion

                //条码
                print += "PP 50,36" + (char)13;
                print += "BARSET " + "\"" + "QRCODE" + "\"" + ",1,1,5,2,1" + (char)13;//二维条码   宽,高,密度,
                print += "PB " + "\"" + reco[0] + "\"" + (char)13;

                //图片
                print += "PRPOS 36,200" + (char)13;
                print += "MAG 1,1" + (char)13;
                print += "PRIMAGE " + "\"" + "0.0" + "\"" + (char)13;//图片


                //线
                print += "PP 214,390" + (char)13; //位置
                print += "DIR2" + (char)13;
                print += "PL 360,4" + (char)13; //高,宽

                //供应商
                print += "PP 250,299" + (char)13;
                print += "DIR1" + (char)13;
                print += "NASC 1254" + (char)13;
                print += "PT" + "\"" + reco[3] + "\"" + (char)13;
                //产品编码
                print += "PP 250,216" + (char)13;
                print += "PT" + "\"" + reco[1] + "\"" + (char)13;

 

                //产品名称
                print += "PP 250,133" + (char)13;
                print += "PT" + "\"" + reco[2] + "\"" + (char)13;
                //批号
                print += "PP 250,50" + (char)13;
                print += "PT" + "\"" + reco[4] + "\"" + (char)13;


                print += "LAYOUT RUM " + "\"" + (char)13;
                print += "PF " + reco[5] + (char)13; //开始打印 带打印次数
                print += "PRINT KEY OFF" + (char)13;

                PrintDialog pd = new PrintDialog();
                pd.PrinterSettings = new PrinterSettings();
                RawPrinterHelper.SendStringToPrinter(PrintName, print);

                Int32 k;
                k = 1500 * Convert.ToInt32(reco[5]);
                System.Threading.Thread.Sleep(k);   //进程延时

                print = "";
                return "0";
            }
            catch (Exception ex)
            {
                return ex.Message.ToString();
            }
        }

Soul 今天 | 园豆:206 (菜鸟二级) | 2013-01-04 09:36
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册