using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cosmos.KPS
{
class OPOSPrint
{
#region 위치
public enum Position
{
Top,
Buttom,
TopAndButtom
}
public enum Alignment
{
Center,
Left,
Right
}
#endregion
#region Character size/Filter
///
/// Character size horizontal [넓이 배율 1~8]
///
public enum CharactersizeH
{
H_1,
H_2,
H_3,
H_4,
H_5,
H_6,
H_7,
H_8
}
///
/// Character size vertical [높이 배율 1~8]
///
public enum CharactersizeV
{
V_1,
V_2,
V_3,
V_4,
V_5,
V_6,
V_7,
V_8
}
///
/// Bold 체 여부
///
public enum TextBold
{
Nomal,
Bold
}
///
/// 밑줄(UnderLine)
///
public enum TextUnderLine
{
Nomal,
UnderLine
}
///
/// 반전 Text 효과
///
public enum TextReverseMode
{
Nomal,
ReverseMode
}
#endregion
#region OposPrint
///
/// Text Print
/// 문자열을 출력 합니다.
///
/// 출력할 문자
/// 정렬(Left, Center, Right)
/// 세로확대(1배~8배)
/// 가로확대(1배~8배)
/// 굵은글씨(BOLD)
/// 밑줄(UnderLine)
/// LineFeed 여부
///
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, CharactersizeV eVerticalSize, CharactersizeH eHorizontalSize, TextBold eBold, TextUnderLine eTextUnderLine, TextReverseMode eTextReverseMode, bool bLineFeed)
{
bool bRet = false;
string sCmdctrlTmp = "";
string ESC = String.Format("{0}", (char)27);
string SP = String.Format("{0}", (char)20);
//string ESC_CUT = Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + ESC + "|P";
//string ESC_FEEDCUT = Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + ESC + "|fP";
string ESC_CUT = ESC + "|50P";
string ESC_FEEDCUT = ESC + "|100fP";
string ESC_BITMAP1 = ESC + "|1B";
string ESC_BITMAP2 = ESC + "|2B";
string ESC_TOPLOGO = ESC + "|tL";
string ESC_BTMLOGO = ESC + "|bL";
string ESC_LINEFEED = ESC + "|lF";
string ESC_FEED = ESC + "|uF";
//string ESC_BOLD = ESC + "|bC";
//string ESC_NOT_BOLD = ESC + "|!bC";
string ESC_UNDERLINE = ESC + "|uC";
string ESC_COLOR = ESC + "|rC";
//string ESC_REVERSE = ESC + "|rvC";
//string ESC_NOT_REVERSE = ESC + "|!rvC";
string ESC_1MAG = ESC + "|1C";
string ESC_2MAG = ESC + "|4C";
string ESC_HMAG = ESC + "|2C";
string ESC_VMAG = ESC + "|3C";
string ESC_H1MAG = ESC + "|1hC";
string ESC_V1MAG = ESC + "|1vC";
string ESC_H2MAG = ESC + "|2hC";
string ESC_V2MAG = ESC + "|2vC";
string ESC_H3MAG = ESC + "|3hC";
string ESC_V3MAG = ESC + "|3vC";
string ESC_H4MAG = ESC + "|4hC";
string ESC_V4MAG = ESC + "|4vC";
string ESC_H5MAG = ESC + "|5hC";
string ESC_V5MAG = ESC + "|5vC";
string ESC_H6MAG = ESC + "|6hC";
string ESC_V6MAG = ESC + "|6vC";
string ESC_H7MAG = ESC + "|7hC";
string ESC_V7MAG = ESC + "|7vC";
string ESC_H8MAG = ESC + "|8hC";
string ESC_V8MAG = ESC + "|8vC";
string ESC_CENTER = ESC + "|cA";
string ESC_RIGHT = ESC + "|rA";
string ESC_NORMAL = ESC + "|N";
sCmdctrlTmp = "";
//정렬
switch (eAlignment)
{
case Alignment.Center: sCmdctrlTmp += ESC_CENTER; break;
case Alignment.Right: sCmdctrlTmp += ESC_RIGHT; break;
case Alignment.Left: sCmdctrlTmp += ESC_NORMAL; break;
}
//확대 Command를 설정.
//sCmdctrlTmp = GetCharactersizeCmd(eVerticalSize, eHorizontalSize);
switch (eVerticalSize)
{
case CharactersizeV.V_2: sCmdctrlTmp += ESC_V2MAG; break;
case CharactersizeV.V_3: sCmdctrlTmp += ESC_V3MAG; break;
case CharactersizeV.V_4: sCmdctrlTmp += ESC_V3MAG; break;
case CharactersizeV.V_5: sCmdctrlTmp += ESC_V4MAG; break;
case CharactersizeV.V_6: sCmdctrlTmp += ESC_V5MAG; break;
case CharactersizeV.V_7: sCmdctrlTmp += ESC_V7MAG; break;
case CharactersizeV.V_8: sCmdctrlTmp += ESC_V8MAG; break;
default: sCmdctrlTmp += ESC_V1MAG; break;
}
switch (eHorizontalSize)
{
case CharactersizeH.H_2: sCmdctrlTmp += ESC_H2MAG; break;
case CharactersizeH.H_3: sCmdctrlTmp += ESC_H3MAG; break;
case CharactersizeH.H_4: sCmdctrlTmp += ESC_H3MAG; break;
case CharactersizeH.H_5: sCmdctrlTmp += ESC_H4MAG; break;
case CharactersizeH.H_6: sCmdctrlTmp += ESC_H5MAG; break;
case CharactersizeH.H_7: sCmdctrlTmp += ESC_H7MAG; break;
case CharactersizeH.H_8: sCmdctrlTmp += ESC_H8MAG; break;
default: sCmdctrlTmp += ESC_H1MAG; break;
}
//UnderLine
if (eTextUnderLine == TextUnderLine.UnderLine)
sCmdctrlTmp += ESC_UNDERLINE;
//Bold
//if (TextBold.Bold == eBold)
// sCmdctrlTmp += ESC_BOLD;
//else
// sCmdctrlTmp += ESC_NOT_BOLD;
//Reverse
//if (TextReverseMode.ReverseMode == eTextReverseMode)
// sCmdctrlTmp += ESC_REVERSE;
//else
// sCmdctrlTmp += ESC_NOT_REVERSE;
if (sValue != "")
{
}
if (bLineFeed == true)
{
sValue = sCmdctrlTmp + sValue + "\r\n";
}
//출력
int nRet = pOPOSPrint.PrintNormal(OPOS.PTR_S_RECEIPT, sValue);
return bRet;
}
///
/// Text Print
/// 문자열을 출력 합니다.
///
/// 출력할 문자
/// 정렬(Left, Center, Right)
/// 세로확대(1배~8배)
/// 가로확대(1배~8배)
/// 굵은글씨(BOLD)
/// 밑줄(UnderLine)
/// LineFeed 여부
///
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, CharactersizeV eVerticalSize, CharactersizeH eHorizontalSize, TextBold eBold, TextUnderLine eTextUnderLine, bool bLineFeed)
{
return OposTextPrint(pOPOSPrint, sValue, eAlignment, eVerticalSize, eHorizontalSize, eBold, eTextUnderLine, TextReverseMode.Nomal, bLineFeed);
}
///
/// 문자열을 출력 합니다.
///
/// 출력할 문자
/// LineFeed 여부
///
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, bool bLineFeed)
{
return OposTextPrint(pOPOSPrint, sValue, Alignment.Left, CharactersizeV.V_1, CharactersizeH.H_1, TextBold.Nomal, TextUnderLine.Nomal, TextReverseMode.Nomal, bLineFeed);
}
///
/// 문자열을 출력 합니다.
///
/// 출력할 문자
/// 정렬(Left, Center, Right)
/// LineFeed 여부
///
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, bool bLineFeed)
{
return OposTextPrint(pOPOSPrint, sValue, eAlignment, CharactersizeV.V_1, CharactersizeH.H_1, TextBold.Nomal, TextUnderLine.Nomal, TextReverseMode.Nomal, bLineFeed);
}
///
/// 문자열을 출력 합니다.
///
/// 출력할 문자
/// 정렬(Left, Center, Right)
/// 세로확대(1배~8배)
/// 가로확대(1배~8배)
/// LineFeed 여부
///
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, CharactersizeV eVerticalSize, CharactersizeH eHorizontalSize, bool bLineFeed)
{
return OposTextPrint(pOPOSPrint, sValue, eAlignment, eVerticalSize, eHorizontalSize, TextBold.Nomal, TextUnderLine.Nomal, TextReverseMode.Nomal, bLineFeed);
}
///
/// 문자열을 출력 합니다.
/// 진한문자열을 출력 할 수 있습니다.
///
/// 출력할 문자
/// 정렬(Left, Center, Right)
/// 굵은글씨(BOLD)
/// LineFeed 여부
///
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, TextBold eBold, bool bLineFeed)
{
return OposTextPrint(pOPOSPrint, sValue, eAlignment, CharactersizeV.V_1, CharactersizeH.H_1, eBold, TextUnderLine.Nomal, TextReverseMode.Nomal, bLineFeed);
}
///
/// 문자열을 출력 합니다.
/// 진한문자열을 출력 할 수 있습니다.
///
/// 출력할 문자
/// 정렬(Left, Center, Right)
/// 굵은글씨(BOLD)
/// LineFeed 여부
///
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, TextUnderLine eTextUnderLine, bool bLineFeed)
{
return OposTextPrint(pOPOSPrint, sValue, eAlignment, CharactersizeV.V_1, CharactersizeH.H_1, TextBold.Nomal, eTextUnderLine, TextReverseMode.Nomal, bLineFeed);
}
///
/// 문자열을 출력 합니다.
/// 역상 출력을 합니다.
///
/// 출력 할 문자
/// 정렬(Left, Center, Right)
/// 반전출력 모드 설정(Reverse Mode)
///
///
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, TextReverseMode eTextReverseMode, bool bLineFeed)
{
return OposTextPrint(pOPOSPrint, sValue, Alignment.Left, CharactersizeV.V_1, CharactersizeH.H_1, TextBold.Nomal, TextUnderLine.Nomal, eTextReverseMode, bLineFeed);
}
#endregion
///
/// 문자열을 출력 합니다.
/// 역상 출력을 합니다.
///
/// 출력 할 문자
/// 정렬(Left, Center, Right)
/// 반전출력 모드 설정(Reverse Mode)
///
///
public static bool OposBarPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue)
{
int nStat = 0;
if (sValue.Length % 2 == 0)
{
nStat = pOPOSPrint.PrintBarCode(OPOS.PTR_S_RECEIPT, sValue, OPOS.PTR_BCS_ITF, 50, 368, OPOS.PTR_BC_CENTER, OPOS.PTR_BC_TEXT_BELOW);
}
else
{
nStat = pOPOSPrint.PrintBarCode(OPOS.PTR_S_RECEIPT, "0" + sValue, OPOS.PTR_BCS_ITF, 50, 368, OPOS.PTR_BC_CENTER, OPOS.PTR_BC_TEXT_BELOW);
}
return true;
}
}
}