using System;
using System.Collections.Generic;
using System.Text;
namespace MacPrinter
{
public class ZPL_Command
{
/// (^EF)
/// ( )
///
///
public string _CmdEraseSetup()
{
string st = "^XA^EF^FS^XZ";
return st.ToUpper();
}
///
///(^XA) ZPL
///
///
public string _CmdStart()
{
return "^XA".ToUpper();
}
///
///(^XZ) ZPL
///
///
public string _CmdEnd()
{
return "^XZ".ToUpper();
}
///
/// (^FS) ( )
///
///
public string _CmdLineEnd()
{
return "^FS".ToUpper();
}
///
///(^A) {^Af,o,h,w}
///
/// (f) O(A-Z,1-9)
/// (o) N(R 90°,I 180°,B 270°,)
/// (h) 15(10-1500)
/// (w) 12(10-1500)
///
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();
}
///
/// (^A) {^Af,o,h,w}
///
/// (f) O(A-Z,1-9)
/// (h) 15(10-1500)
/// (w) 12(10-1500)
///
public string _SetFont(string DesiredFont, int FontHeight, int FontWidth)
{
return this._SetFont(DesiredFont, "N", FontHeight, FontWidth);
}
///
/// (^A@) {^A@o,h,w,n}
///
/// N(R 90°,I 180°,B 270°,)
/// 15(10-1500)
/// 12(10-1500)
/// Font Name(Cyrillic.FNT)
///
public string _SetFont(string FontOrientation, int FontHeight, int FontWidth, string FontName)
{
return string.Format("^A@{0},{1},{2},{3}", FontOrientation, FontHeight, FontWidth, FontName);
}
///
/// (^B1o,e,h,f,g)
///
///
public string _SetCode11()
{
return "";
}
///
/// (^B3)Code39 (^B3o,e,h,f,g)
///
/// 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;
/// Mod-43 Check Digit:
///Default value: N = No;
///Other value: Y = Yes
/// Bar Code Height:
/// Default value: Value set by ^BY ;
///Other values: 1 dot to 9999 dots
///
/// Print Interpretation Line
///Default value: Y = Yes;
///Other value: N = No
/// Print Interpretation Line Above Code
///Default value: N = No ;
///Other value: Y = Yes
///
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();
}
///
/// (^B4)Code49 (^B4o,h,f,m)
///
///
/// 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;
/// 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.
/// Print Interpretation Line
///Default value: N = No line printed.
///Other values:
///A = Print interpretation line above code.;
///B = Print interpretation line below code.
/// 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;
///
public string _SetCode49(string Orientation, int Height, string f, string m)
{
return string.Format("^B4{0},{1},{2},{3}", Orientation, Height, f, m).ToUpper();
}
///
/// (^B7)PDF417 Bar Code(^B7o,h,s,c,r,t)
///
/// 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;
/// 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 to height of label.;
///NOTE: 1 is not a recommended value.
/// Security Level
///Determines the number of error detection and correction
///code words to be generated for the symbol.
///Default level provides only error detection (no correction).
///Increasing the security level adds increasing
///levels of error correction. (Increases symbol size.)
///Default value: 0 = Error detection only;
///Other values: 1 to 8.;
///Error detection plus correction.
/// Number of Data Columns to Encode
///User can specify number of codeword columns giving
///control over the width of the symbol.;
///Default value: 1:2 row/column aspect ratio.;
///Other values: 1 to 30;
/// Number of Rows to Encode
///User can specify number of symbol rows giving control
///over the height of the symbol.;
///Default value: 1:2 row/column aspect ratio.;
///Other values: 3 to 90;;
///Example: With no row or column values entered, 72
///codewords would be encoded into a symbol of 6 columns
///and 12 rows. (Depending on codewords, aspect ratio
///will not always be exact.)
/// Truncate Right Row Indicators and Stop Pattern
///Default value: N = No truncation
///Print right row indicators and stop pattern.
///Other value: Y = Yes perform truncation.
///
public string _SetCodeBDF417(string o, int h, int s, int c, int r, string t)
{
return string.Format("^B7{0},{1},{2},{3},{4},{5}", o, h, s, c, r, t).ToUpper();
}
//
//
///
/// (^B8)EAN-8 Bar Code(^B8o,h,f,g)
///
/// 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;
/// Bar Code Height
///Default value: Value set by ^BY;
///Other values: 1 dot to 9999 dots
/// Print Interpretation Line
///Default value: Y = Yes;
///Other value: N = No
/// Print Interpretation Line Above Code
///Default value: N = No;
///Other value: Y = Yes
///
public string _SetCodeEAN8(string o, int h, string f, string g)
{
return string.Format("^B8{0},{1},{2},{3}", o, h, f, g).ToUpper();
}
///
/// (^B9)UPC-E Bar Code(^B9o,h,f,g,e)
///
/// 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
/// Bar Code Height
///Default value: Value set by ^BY;
///Other values: 1 dot to 9999 dots
/// Print Interpretation Line
///Default value: Y = Yes;
///Other value: N = No
/// Print Interpretation Line Above Code
///Default value: N = No;
///Other value: Y = Yes
/// Print Check Digit
///Default value: Y = Yes,;
///Other value: N = No
///
public string _SetCodeUPC_E(string o, int h, string f, string g, string e)
{
return string.Format("^B9{0},{1},{2},{3},{4}", o, h, f, g, e).ToUpper();
}
///
/// (^BA)Code 93 Bar Code(^BAo,h,f,g,e)
///
/// 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
/// Bar Code Height
///Default value: Value set by ^BY;
///Other values: 1 dot to 9999 dots
/// Print Interpretation Line
///Default value: Y = Yes;
///Other value: N = No
/// Print Interpretation Line Above Code
///Default value: N = No;
///Other value: Y = Yes
/// Print Check Digit
///Default value: Y = Yes,;
///Other value: N = No
///
public string _SetCode93(string o, int h, string f, string g, string e)
{
return string.Format("^BA{0},{1},{2},{3},{4}", o, h, f, g, e).ToUpper();
}
///
/// (^BC)Code 128 Bar Code(Subsets A, B, and C)(^BCo,h,f,g,e,m)
///
/// 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
/// Bar Code Height
///Default value: Value set by ^BY;
///Other values: 1 dot to 9999 dots
/// Print Interpretation Line
///Default value: Y = Yes
///Other value: N = No
/// Print Interpretation Line Above Code
///Default value: N = No;
///Other value: Y = Yes
/// UCC Check Digit
///Default value: N = No;;
///Other value: Y = Yes
/// Mode
///Default value: N = No mode selected;;
///Other value: U = UCC Case Mode;;
///(^FD or ^SN statement must contain 19
///numeric digits (it can also contain valid alpha
///characters). Subset C using FNC1 values is
///automatically selected.
///
public string _SetCode128(string o, int h, string f, string g, string e, string m)
{
return string.Format("^BC{0},{1},{2},{3},{4},{5}", o, h, f, g, e, m);
}
///
/// (^BC)Code 128 Bar Code(Subsets A, B, and C)(^BCo,h,f,g,e,m)
///
/// 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
/// Bar Code Height
///Default value: Value set by ^BY;
///Other values: 1 dot to 9999 dots
/// Print Interpretation Line
///Default value: Y = Yes
///Other value: N = No
/// Print Interpretation Line Above Code
///Default value: N = No;
///Other value: Y = Yes
/// UCC Check Digit
///Default value: N = No;;
///Other value: Y = Yes
///
public string _SetCode128(string o, int h, string f, string g, string e)
{
return string.Format("^BC{0},{1},{2},{3},{4}", o, h, f, g, e);
}
///
/// (^BY) Change Bar Code Default Parameters( , ( ) )
///
/// ( ) ( :2 :1-10 ) Module (Narrow Bar) Width (Initial power -up value: 2 dots ,Acceptable values: 1-10 dots)
/// ( :3.0 :2.0 3.0,0.1 ( ))Wide Bar to Narrow Bar Width Ratio(Initial power-up ratio: 3.0 ,Acceptable ratios: From 2.0 to 3.0 in .1 increments.)
/// :10 :1 (Height of Bars(Initial Power-up value: 10 dots, Acceptable values: 1 dot to height of label)
///
public string _changeBarCodeDefault(int w, int r, int h)
{
string _by = string.Format("^BY{0},{1},{2}", w, r, h);
return _by.ToUpper();
}
///
/// (^BY) Change Bar Code Default Parameters( , ( ) )
///
/// ( ) ( :2 :1-10 ) Module (Narrow Bar) Width (Initial power -up value: 2 dots ,Acceptable values: 1-10 dots)
/// ( :3.0 :2.0 3.0,0.1 ( ))Wide Bar to Narrow Bar Width Ratio(Initial power-up ratio: 3.0 ,Acceptable ratios: From 2.0 to 3.0 in .1 increments.)
///
public string _changeBarCodeDefault(int w, string r)
{
string _by = string.Format("^BY{0},{1}", w, r);
return _by.ToUpper();
}
///
/// (^LR) Reverse Print All Fields
///
/// (y) {Y or N}
///
public string _SetLableReverse(string reverse)
{
return string.Format("^LR{0}", reverse);
}
///
/// (^LL) Lable
///
/// Number of Dots Along Y-Axis{Default value:1225 for Stripe ; 1244 for Xi printers}
///
public string _SetLableLength(int iLength)
{
return string.Format("^LL{0}", iLength);
}
///
/// (^LS) Lable
///
/// Shift Left Value of dots(Acceptable values: 0 to 9999 dots)
///
public string _SetLableShift(int shiftValue)
{
return string.Format("^LS{0}", shiftValue);
}
///
/// (^LH) Lable ( ),
///
/// X
/// Y
/// Lable ( )
/// Lable ( )
///
public string _SetLableHomeAndTop(int x, int y, int width, int height)
{
if (y < width && x < height)
{
string _lh_lt = string.Format("^LH{0},{1}^LT{1}", x, y);
return _lh_lt.ToUpper();
}
else
{
throw new Exception(" ");
}
}
///
/// (^LH) Lable
///
/// X
/// Y
/// Lable ( )
/// Lable ( )
///
public string _SetLableHome(int x, int y)
{
return string.Format("^LH{0},{1}", x, y);
}
///
///(^LT) Lable ( )
///
///
///
public string _SetLableTop(int iTop)
{
return string.Format("^LT{0}", iTop);
}
///
/// (^DF)
///
/// (STOREFMT.ZPL)
///
public string _SetDownLoadFont(string FileName)
{
string _df = string.Format("^DF{0}", FileName);
return _df.ToUpper();
}
///
///(^MD)
///
/// 15(-30 +30)
///
public string _SetMediaDarkness(int darknessVale)
{
string _md = string.Format("^MD{0}", darknessVale);
return _md.ToUpper();
}
///
/// (^ML) Maximum Label Length
///
/// Maximum Label Length in Dot Rows(Default value:Last permanently saved value)
///
public string _SetMaxLableLength(int iLength)
{
return string.Format("^ML{0}", iLength);
}
///
/// (^MM)Print Mode
///
///
/// Desired Mode
/// Default value:
///T = Tear Off ;
///Other Values:
///P = Peel Off (not available on S-300 printers)
///R = Rewind (Instruction ignored if parameter
///missing or incorrect.)
///A = Applicator
///
/// Pre-Peel Select(Y or N)
///
public string _SetPrintMode(string strDesiredMode, string strPrePeelSelect)
{
return string.Format("^MM{0},{1}", strDesiredMode, strPrePeelSelect);
}
///
/// (^MN) Set Media Tracking
///
/// Media Being Used
///N = Continuous Media ;
///Y = Non-Continuous Media Web Sensing
///
public string _SetMedieTracking(string strTrack)
{
return string.Format("^MN{0}", strTrack);
}
///
/// (^MU)Set Mode Units
///
/// units type
/// Default: D = Dots
///I = Inches
///M = Millimeters
///
public string _SetModeUnits(string unitsType)
{
return string.Format("^MU{0}", unitsType);
}
///
///(^PR _^PW)
///
/// 3(A or 2 50.8 mm/sec,B or 3 76.2 mm/sec,C or 4 101.6 mm/sec,5 127 mm/sec,D or 6 152.4 mm/sec,E or 8 203.2 mm/sec.)
/// Default value: Speed D(A or 2 50.8 mm/sec,B or 3 76.2 mm/sec,C or 4 101.6 mm/sec,5 127 mm/sec,D or 6 152.4 mm/sec,E or 8 203.2 mm/sec)
/// Default value: Speed D(A or 2 50.8 mm/sec,B or 3 76.2 mm/sec,C or 4 101.6 mm/sec,5 127 mm/sec,D or 6 152.4 mm/sec,E or 8 203.2 mm/sec)
/// ( Lable )
///
public string _SetPrintRateAndWidth(int PrintSpeed, int SlewSpeed, int BackfeedSpeed, int PrintWidth)
{
string _pr_pw = string.Format("^PR{0},{1},{2}^PW{3}", PrintSpeed, SlewSpeed, BackfeedSpeed, PrintWidth);
return _pr_pw.ToUpper();
}
///
///(^PR)
///
/// 3(A or 2 50.8 mm/sec,B or 3 76.2 mm/sec,C or 4 101.6 mm/sec,5 127 mm/sec,D or 6 152.4 mm/sec,E or 8 203.2 mm/sec.)
/// Default value: Speed D(A or 2 50.8 mm/sec,B or 3 76.2 mm/sec,C or 4 101.6 mm/sec,5 127 mm/sec,D or 6 152.4 mm/sec,E or 8 203.2 mm/sec)
/// Default value: Speed D(A or 2 50.8 mm/sec,B or 3 76.2 mm/sec,C or 4 101.6 mm/sec,5 127 mm/sec,D or 6 152.4 mm/sec,E or 8 203.2 mm/sec)
///
public string _SetPrintRate(int PrintSpeed, int SlewSpeed, int BackfeedSpeed)
{
return string.Format("^PR{0},{1},{2}", PrintSpeed, SlewSpeed, BackfeedSpeed);
}
///
/// (^PR)
///
/// :
/// Print Speed
///Default value: Speed A
///Acceptable values :
///A or 2 50.8 mm/sec. (2 inches/sec.)
///B or 3 76.2 mm/sec. (3 inches/sec.)
///C or 4 101.6 mm/sec. (4 inches/sec.)
///5 127 mm/sec. (5 inches/sec.)
///D or 6 152.4 mm/sec. (6 inches/sec.)
///E or 8 203.2 mm/sec. (8 inches/sec.)
///
///
public string _SetPrintRate(int PrintSpeed)
{
return string.Format("^PR{0}", PrintSpeed);
}
///
/// (^PW) ( )
///
///
///
public string _SetPrintWidth(int printWidth)
{
return string.Format("^PW{0}", printWidth);
}
///
/// (^PR_^PW)
///
/// 3(A or 2 50.8 mm/sec,B or 3 76.2 mm/sec,C or 4 101.6 mm/sec,5 127 mm/sec,D or 6 152.4 mm/sec,E or 8 203.2 mm/sec.)
/// ( Lable )
///
public string _SetPrintRateAndWidth(int PrintSpeed, int PrintWidth)
{
return this._SetPrintRateAndWidth(PrintSpeed, 6, 6, PrintWidth);
}
///
/// (^PR_^PW)
///
///
///
public string _SetPrintRateAndWidth(int PrintWidth)
{
return this._SetPrintRateAndWidth(3, 6, 6, PrintWidth);
}
///
/// (^FO) , ^LH
///
/// Number of Dots along X-axis(Default value: = 0,Acceptable values: 0 - 9999)
/// Number of Dots along Y-axis(Default value: = 0,Acceptable values: 0 - 9999)
///
public string _SetFieldOrigin(int x, int y)
{
string _fo = string.Format("^FO{0},{1}", x, y);
return _fo.ToUpper();
}
///
/// Code 128 Bar Code (^BC)
///
/// //[N = (Normal), R = 90 (Roated), I = 180 (Inverted), B = 270 (Bottom)]
/// // [ : ^BY :1 9999 ]
/// //[ : Y = (Yes) :N = (No]
/// //[ : N = : Y = ]
/// UCC // :Y = (Yes) :N = (No)
/// = // :N = , :U = UCC >
///
public string _BCCode128(string o, int h, string f, string g, string e, string m)
{
string _bc = string.Format("^BC{0},{1},{2},{3},{4},{5}", o, h, f, g, e, m);
return _bc.ToUpper();
}
///
/// Code 128 Bar Code(^BC)
///
/// //[N = (Normal), R = 90 (Roated), I = 180 (Inverted), B = 270 (Bottom)]
/// // [ : ^BY :1 9999 ]
/// //[ : Y = (Yes) :N = (No]
/// //[ : N = : Y = ]
/// UCC // :Y = (Yes) :N = (No)
///
public string _BCCode128(string o, int h, string f, string g, string e)
{
return this._BCCode128(o, h, f, g, e, "N").ToUpper();
}
///
/// (^FD)
///
/// ( 3072 )
///
public string _SetFieldData(string data)
{
string _fd = string.Format("^FD{0}", data);
return _fd;
}
///
/// (^FH) ( ^FD 。^FH ^FD ) ^FD , (_)。 (_)。 ,( ^FD,^FV( ), ^SN( )
///
///
public string _FieldHex()
{
return "^FH".ToUpper();
}
///
/// (^SN)
///
///
/// /
/// . :N= ; :Y=
///
public string _SetSerializationData(string StartingValue, int IncrementValue, string LeadingZeros)
{
string _sn = string.Format("^SN{0},{1},{2}", StartingValue, IncrementValue, LeadingZeros.ToUpper());
return _sn;
}
///
///(^PQ)
///
/// (Total Quantity of Labels to Print)
///
public string _SetPrintQueantity(int q)
{
string _pq = string.Format("^PQ{0}", q);
return _pq.ToUpper();
}
///
/// (^PQ)
/// {Exemples: ^PQ50,10,1,Y:---- Print a total quantity of 50 labels with one replicate
///of each serial number. Print the total quantity in groups of 10, but do
///not pause after every group.}
///
/// Total Quantity of Labels to Print
/// ;Default value: 1
///;Acceptable values: 1 - 99,999,999
/// Pause (Group) Count;
/// Default value: 0 = no pause
///Acceptable values: 0 - 99,999,999 labels between pauses
///
/// Replicates of Each Serial Number;
/// Default value: 0 = no replicates
///Acceptable values: 0 - 99,999,999 replicates
///
/// Override Pause Count;
/// Default value: N = No
///Other value: Y = Yes
///
///
public string _SetPrintQueantity(int q, int p, int r, string o)
{
return string.Format("^PQ{0},{1},{2},{3}", q, p, r, o);
}
///
/// (^PM)Print Mirror Image of Lable(
/// NOTE: The ^PM will remain active unless turned off by ^PMN
///instruction or the printer is powered down.)
///
/// Mirror Print Entire Label
///Y = Yes
///N = No {I.V.P. = N}
///
public string _SetMirrorImageLable(string a)
{
return string.Format("^PM{0}", a);
}
///
/// (^PO)Print Orientation
///
/// a = Invert 180 Degrees
///N = Normal {I.V.P. = N}
///I = Invert
///
public string _SetPrintOrientation(string a)
{
return string.Format("^PO{0}", a);
}
///
/// (^GF)Graphic Field( )
///
///
/// Default:ASCII
/// Value:
/// A = ACSII Hex:
/// This follows the conventional download format
/// used for all other download commands.
/// B = Binary:
/// The data sent to the printer after the c parameter
/// is strictly binary.
/// C = Compression Binary :
/// The data sent after parameter c is in a compressed
/// binary format. The data is compressed on
/// the host side using a compression algorithm supplied
/// by Zebra. The data is then decompressed
/// and placed directly in the bitmap.
///
///
/// Binary Byte Count
/// Default:Note-entire command is ignored when not specified
/// Value:Total number of bytes
/// Range:1 to 99999
///
///
/// Graphic Field Count
///
///
/// Bytes per Row
///
///
/// Default:None=must be specified
/// ASCII Hex Data:
///
///
public string _SetGraphicField(string CompressionType, string BinaryByteCount,
string GraphicFieldCount, string ByteperRow, string strData)
{
return string.Format("^GF{0},{1},{2},{3},{4}", CompressionType.ToUpper(), BinaryByteCount, GraphicFieldCount, ByteperRow, strData);
}
public string _SetFieldNumber(int i)
{
return string.Format("^FN{0}", i);
}
public string _SetRecallFormat(string FieldName)
{
return string.Format("^XF{0}", FieldName);
}
///
///(^FWr) Set Field Orientation
///
/// Rotate Field
/// N = Normal {I.V.P. = N}
/// R = Rotated 90 degrees;
/// I = Inverted (180 degrees);
/// B = Bottom Up (270 degrees read from bottom up).
///
///
public string _SetFieldOrientation(string Orig)
{
return string.Format("^FW{0}", Orig);
}
}
}