62,046
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 以大一倍的字体打印数据
/// </summary>
/// <param name="Data">需要打印的数据</param>
/// <returns>是否打印成功</returns>
public bool WriteBig(string Data)
{
bool Result = false;
Result = SetNormalFont();
if (!Result) return Result;
try
{
byte[] temp;
//1B, 33 设置行高, 54个像素
temp = new byte[] { 0x1B, 0x33, 0x48 };
LptPort.Write(temp);
//1B 4D 选择字体 03为汉字字体
temp = new byte[] { 0x1B, 0x4D, 0x03 };
LptPort.Write(temp);
//横向放大和纵向放大不可同时作用
//1D 21 选择字体大小,横向放大1倍
temp = new byte[] { 0x1D, 0x21, 0x10 };
LptPort.Write(temp);
//1D 21 选择字体大小,纵向放大1倍
//temp = new byte[] { 0x1D, 0x21, 0x01 };
//LptPort.Write(temp, 0, temp.Length);
//1B 45 选择/取消加粗模式 01选择/00取消
temp = new byte[] { 0x1B, 0x45, 0x01 };
LptPort.Write(temp);
Write(Data);
Result = true;
}
catch { Result = false; }
Result = SetNormalFont();
return Result;
}