C#打印机操作类

using System;
using System.Collections.Generic;
using System.Text;

namespace MacPrinter
{
    public class ZPL_Command
    {

        /// (^EF)<summary>
        /// 清除设定 (已包含起始结束命令)
        /// </summary>
        /// <returns></returns>
        public string _CmdEraseSetup()
        {
            string st = "^XA^EF^FS^XZ";
            return st.ToUpper();
        }

        /// <summary>
        ///(^XA) ZPL命令开始
        /// </summary>
        /// <returns></returns>
        public string _CmdStart()
        {
            return "^XA".ToUpper();
        }

        /// <summary>
        ///(^XZ)  ZPL命令结尾
        /// </summary>
        /// <returns></returns>
        public string _CmdEnd()
        {
            return "^XZ".ToUpper();
        }

        /// <summary>
        /// (^FS)一个字段的结束(结束一行命令)
        /// </summary>
        /// <returns></returns>
        public string _CmdLineEnd()
        {
            return "^FS".ToUpper();
        }

        /// <summary>
        ///(^A)字体设定{^Af,o,h,w}
        /// </summary>
        /// <param name="DesiredFont">(f)需要选择的字体默认为O(A-Z,1-9)</param>
        /// <param name="FontOrientation">(o)字体是否旋转默认N(R旋转90°,I旋转180°,B旋转270°,)</param>
        /// <param name="FontHeight">(h)设定字体高度以点计算默认为15(10-1500)</param>
        /// <param name="FontWidth">(w)设定字体宽度以点计算默认为12(10-1500)</param>
        /// <returns></returns>
        public string _SetFont(string DesiredFont, string FontOrientation, int FontHeight, int FontWidth)
        {
            string _a = string.Format("^A{0}{1},{2},{3}", DesiredFont, FontOrientation, FontHeight, FontWidth);
            return _a.ToUpper();
        }

        /// <summary>
        /// (^A)字体设定{^Af,o,h,w}
        /// </summary>
        /// <param name="DesiredFont">(f)需要选择的字体默认为O(A-Z,1-9)</param>
        /// <param name="FontHeight">(h)设定字体高度以点计算默认为15(10-1500)</param>
        /// <param name="FontWidth">(w)设定字体宽度以点计算默认为12(10-1500)</param>
        /// <returns></returns>
        public string _SetFont(string DesiredFont, int FontHeight, int FontWidth)
        {
            return this._SetFont(DesiredFont, "N", FontHeight, FontWidth);
        }

        /// <summary>
        /// (^A@)调用字体名字设定字体{^A@o,h,w,n}
        /// </summary>
        /// <param name="FontOrientation">字体是否旋转默认N(R旋转90°,I旋转180°,B旋转270°,)</param>
        /// <param name="FontHeight">设定字体高度以点计算默认为15(10-1500)</param>
        /// <param name="FontWidth">设定字体宽度以点计算默认为12(10-1500)</param>
        /// <param name="FontName">Font Name(Cyrillic.FNT)</param>
        /// <returns></returns>
        public string _SetFont(string FontOrientation, int FontHeight, int FontWidth, string FontName)
        {
            return string.Format("^A@{0},{1},{2},{3}", FontOrientation, FontHeight, FontWidth, FontName);
        }

        /// <summary>
        /// (^B1o,e,h,f,g)
        /// </summary>
        /// <returns></returns>
        public string _SetCode11()
        {
            return "";
        }

        /// <summary>
        /// (^B3)Code39码(^B3o,e,h,f,g)
        /// </summary>
        /// <param name="Orientation">Orientation:
        ///Default value: Current ^FW setting
        ///Other values:
        ///N = Normal;
        ///R = Rotated, 90 degrees clockwise;
        ///I = Inverted, 180 degrees;
        ///B = Read from Bottom Up, 270 degrees;</param>
        /// <param name="e">Mod-43 Check Digit:
        ///Default value: N = No;
        ///Other value: Y = Yes</param>
        /// <param name="Height">Bar Code Height:
        /// Default value: Value set by ^BY ;
        ///Other values: 1 dot to 9999 dots
        /// </param>
        /// <param name="f">Print Interpretation Line
        ///Default value: Y = Yes;
        ///Other value: N = No</param>
        /// <param name="g">Print Interpretation Line Above Code
        ///Default value: N = No ;
        ///Other value: Y = Yes</param>
        /// <returns></returns>
        public string _SetCode39(string Orientation, string e, int Height, string f, string g)
        {
            return string.Format("^B3{0},{1},{2},{3},{4}", Orientation, e, Height, f, g).ToUpper();
        }

        /// <summary>
        /// (^B4)Code49码(^B4o,h,f,m)
        /// </summary>
        /// <param name="Orientation">
        /// Orientation
        ///Default value: Current ^FW value
        ///(^FW defaults to N = Normal at power-up);
        ///Other values:
        ///N = Normal;
        ///R = Rotated, 90 degrees clockwise;
        ///I = Inverted, 180 degrees;
        ///B = Read from Bottom Up, 270 degrees;</param>
        /// <param name="Height">Height Multiplier of Individual Rows
        ///Defined: This number, multiplied by the module,;
        ///equals the height of the individual rows in dots.;
        ///Default value: Value set by ^BY;
        ///Other values: 1 to height of label.;
        ///NOTE: 1 is not a recommended value.</param>
        /// <param name="f">Print Interpretation Line
        ///Default value: N = No line printed.
        ///Other values:
        ///A = Print interpretation line above code.;
        ///B = Print interpretation line below code.</param>
        /// <param name="m">Starting Mode
        ///Default value: A = Automatic Mode. Printer determines
        ///starting mode by analyzing field data.;
        ///Other values:
        ///0 = Regular Alphanumeric Mode;
        ///1 = Multiple Read Alphanumeric;
        ///2 = Regular Numeric Mode;
        ///3 = Group Alphanumeric Mode;
        ///4 = Regular Alphanumeric Shift 1;
        ///5 = Regular Alphanumeric Shift 2;</param>
        /// <returns></returns>
        public string _SetCode49(string Orientation, int Height, string f, string m)
        {
            return string.Format("^B4{0},{1},{2},{3}", Orientation, Height, f, m).ToUpper();

        }

        /// <summary>
        /// (^B7)PDF417 Bar Code(^B7o,h,s,c,r,t)
        /// </summary>
        /// <param name="o">Orientation Default value: Current ^FW value
        ///
        ///(^FW defaults to N = Normal at power-up);
        ///Other values:
        ///N = Normal;
        ///R = Rotated, 90 degrees clockwise;
        ///I = Inverted, 180 degrees;
        ///B = Read from Bottom Up, 270 degrees;</param>
        /// <param name="h">Bar Code Height for Individual Rows
        ///(This number, multiplied by the module, equals the
        ///height of the individual rows in dots.)
        ///Default value: Value set by ^BY;
        ///Other values: 1 dot t
  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

smartsmile2012

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值