public static byte[] CreateQrCodeData(Emulation emulation) { byte[] data; data = Encoding.UTF8.GetBytes("Hello World.\n"); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.Append(Encoding.UTF8.GetBytes("*Cell:2*\n")); builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.L, 2); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("*Cell:8*\n")); builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.L, 8); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("*Level:L*\n")); builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.L, 4); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("*Level:M*\n")); builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.M, 4); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("*Level:Q*\n")); builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.Q, 4); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("*Level:H*\n")); builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.H, 4); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*AbsolutePosition:40*\n")); builder.AppendQrCodeWithAbsolutePosition(data, QrCodeModel.No2, QrCodeLevel.L, 4, 40); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Center*\n")); builder.AppendQrCodeWithAlignment(data, QrCodeModel.No2, QrCodeLevel.L, 4, AlignmentPosition.Center); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Right*\n")); builder.AppendQrCodeWithAlignment(data, QrCodeModel.No2, QrCodeLevel.L, 4, AlignmentPosition.Right); builder.AppendUnitFeed(32); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public override void AppendEscPos3inchTextReceiptData(ICommandBuilder builder, bool utf8) { string encoding; if (utf8) { encoding = "UTF-8"; builder.AppendCodePage(CodePageType.UTF8); } else { encoding = "Big5"; } builder.AppendCharacterSpace(0); builder.AppendAlignment(AlignmentPosition.Center); builder.AppendEmphasis(true); builder.Append(Encoding.GetEncoding(encoding).GetBytes("\n")); builder.AppendMultipleHeight(Encoding.GetEncoding(encoding).GetBytes("Star Micronics\n"), 3); builder.AppendEmphasis(false); builder.Append(Encoding.GetEncoding(encoding).GetBytes("------------------------------------------\n")); builder.AppendMultiple(Encoding.GetEncoding(encoding).GetBytes( "電子發票證明聯\n" + "103年01-02月\n" + "EV-99999999\n"), 2, 2); builder.AppendAlignment(AlignmentPosition.Left); builder.Append(Encoding.GetEncoding(encoding).GetBytes( "2014/01/15 13:00\n" + "隨機碼 : 9999 總計 : 999\n" + "賣方 : 99999999\n" + "\n")); builder.AppendAlignment(AlignmentPosition.Center); builder.AppendQrCode(Encoding.GetEncoding("ASCII").GetBytes("http://www.star-m.jp/eng/index.html"), QrCodeModel.No2, QrCodeLevel.Q, 5); builder.AppendAlignment(AlignmentPosition.Left); builder.Append(Encoding.GetEncoding(encoding).GetBytes( "\n" + "商品退換請持本聯及銷貨明細表。\n" + "9999999-9999999 999999-999999 9999\n" + "\n")); builder.AppendAlignment(Encoding.GetEncoding(encoding).GetBytes("銷貨明細表 (銷售)\n"), AlignmentPosition.Center); builder.AppendAlignment(Encoding.GetEncoding(encoding).GetBytes("2014-01-15 13:00:02\n"), AlignmentPosition.Right); builder.Append(Encoding.GetEncoding(encoding).GetBytes( "\n" + "烏龍袋茶2g20入 55 x2 110TX\n" + "茉莉烏龍茶2g20入 55 x2 110TX\n" + "天仁觀音茶2g*20 55 x2 110TX\n")); builder.AppendEmphasis(Encoding.GetEncoding(encoding).GetBytes( " 小 計 : 330\n" + " 總 計 : 330\n")); builder.Append(Encoding.GetEncoding(encoding).GetBytes( "------------------------------------------\n" + "現 金 400\n" + " 找 零 : 70\n")); builder.AppendEmphasis(Encoding.GetEncoding(encoding).GetBytes(" 101 發票金額 : 330\n")); builder.Append(Encoding.GetEncoding(encoding).GetBytes( "2014-01-15 13:00\n" + "\n")); builder.AppendAlignment(AlignmentPosition.Center); builder.AppendBarcode(Encoding.GetEncoding("ASCII").GetBytes("{BStar."), BarcodeSymbology.Code128, BarcodeWidth.Mode2, 40, true); builder.AppendAlignment(AlignmentPosition.Left); builder.Append(Encoding.GetEncoding(encoding).GetBytes( "\n" + "商品退換、贈品及停車兌換請持本聯。\n" + "9999999-9999999 999999-999999 9999\n")); }