public static byte[] CreateLineSpaceData(Emulation emulation) { byte[] data = Encoding.UTF8.GetBytes("Hello World."); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.AppendLineSpace(32); builder.AppendLineFeed(data); builder.AppendLineFeed(data); builder.AppendLineFeed(data); builder.AppendLineSpace(24); builder.AppendLineFeed(data); builder.AppendLineFeed(data); builder.AppendLineFeed(data); builder.AppendLineSpace(32); builder.AppendLineFeed(data); builder.AppendLineFeed(data); builder.AppendLineFeed(data); builder.AppendLineSpace(24); builder.AppendLineFeed(data); builder.AppendLineFeed(data); builder.AppendLineFeed(data); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateAlignmentData(Emulation emulation) { byte[] data = Encoding.UTF8.GetBytes("Hello World.\n"); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.Append(data); builder.AppendAlignment(AlignmentPosition.Center); builder.Append(data); builder.AppendAlignment(AlignmentPosition.Right); builder.Append(data); builder.AppendAlignment(AlignmentPosition.Left); builder.Append(data); builder.AppendAlignment(data, AlignmentPosition.Center); builder.AppendAlignment(data, AlignmentPosition.Right); builder.Append(data); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateUnderLineData(Emulation emulation) { byte[] data = Encoding.UTF8.GetBytes("Hello World.\n"); byte[] dataHalf0 = Encoding.UTF8.GetBytes("Hello "); byte[] dataHalf1 = Encoding.UTF8.GetBytes("World.\n"); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.Append(data); builder.AppendUnderLine(true); builder.Append(data); builder.AppendUnderLine(false); builder.Append(data); builder.AppendUnderLine(data); builder.Append(data); builder.AppendUnderLine(dataHalf0); builder.Append(dataHalf1); builder.Append(dataHalf0); builder.AppendUnderLine(dataHalf1); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateTextReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt, int width, bool utf8, bool receipt, bool info, bool qrCode) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); localizeReceipt.AppendTextReceiptData(builder, utf8); builder.EndDocument(); byte[] receiptsData = builder.Commands; byte[] urlData = SMCSAllReceipts.UploadData(receiptsData, emulation, localizeReceipt.CharacterCode, width); ICommandBuilder printDataBuilder = StarIoExt.CreateCommandBuilder(emulation); printDataBuilder.BeginDocument(); if (receipt) { localizeReceipt.AppendTextReceiptData(printDataBuilder, utf8); } byte[] allReceiptsData = SMCSAllReceipts.GenerateAllReceipts(urlData, emulation, info, qrCode); printDataBuilder.AppendRaw(allReceiptsData); printDataBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); printDataBuilder.EndDocument(); return(printDataBuilder.Commands); }
public static byte[] CreatePasteTextBlackMarkData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, string text, bool doubleHeight, BlackMarkType type, bool utf8) { ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.AppendBlackMark(type); if (doubleHeight) { commandBuilder.AppendMultipleHeight(2); localizeReceipts.AppendPasteTextLabelData(commandBuilder, text, utf8); commandBuilder.AppendMultipleHeight(1); } else { localizeReceipts.AppendPasteTextLabelData(commandBuilder, text, utf8); } commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); // commandBuilder.AppendBlackMark(BlackMarkType.Invalid); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreatePasteTextBlackMarkData(Emulation emulation, LocalizeReceipt localizeReceipt, string pasteText, bool doubleHeight, BlackMarkType type, bool utf8) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.AppendBlackMark(type); if (doubleHeight) { builder.AppendMultipleHeight(2); localizeReceipt.AppendPasteTextLabelData(builder, pasteText, utf8); builder.AppendMultipleHeight(1); } else { localizeReceipt.AppendPasteTextLabelData(builder, pasteText, utf8); } builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateScaleRasterReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt, int width, bool bothScale, bool receipt, bool info, bool qrCode) { Bitmap image = localizeReceipt.CreateScaleRasterReceiptImage(); byte[] urlData = SMCSAllReceipts.UploadBitmap(image); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); if (receipt) { builder.AppendBitmap(image, false, width, bothScale); } byte[] allReceiptsData; if (emulation == Emulation.StarGraphic) { allReceiptsData = SMCSAllReceipts.GenerateAllReceipts(urlData, emulation, info, qrCode, width); // Support to centering in Star Graphic. } else { allReceiptsData = SMCSAllReceipts.GenerateAllReceipts(urlData, emulation, info, qrCode);// Non support to centering in Star Graphic. } builder.AppendRaw(allReceiptsData); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreatePdf417Data(Emulation emulation) { byte[] data; data = Encoding.UTF8.GetBytes("Hello World.\n"); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.Append(Encoding.UTF8.GetBytes("\n*Module:2*\n")); builder.AppendPdf417(data, 0, 1, Pdf417Level.ECC0, 2, 2); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Module:4*\n")); builder.AppendPdf417(data, 0, 1, Pdf417Level.ECC0, 4, 2); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Column:2*\n")); builder.AppendPdf417(data, 0, 2, Pdf417Level.ECC0, 2, 2); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Column:4*\n")); builder.AppendPdf417(data, 0, 4, Pdf417Level.ECC0, 2, 2); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Line:10*\n")); builder.AppendPdf417(data, 10, 0, Pdf417Level.ECC0, 2, 2); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Line:40*\n")); builder.AppendPdf417(data, 40, 0, Pdf417Level.ECC0, 2, 2); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Level:ECC0*\n")); builder.AppendPdf417(data, 0, 7, Pdf417Level.ECC0, 2, 2); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Level:ECC8*\n")); builder.AppendPdf417(data, 0, 7, Pdf417Level.ECC8, 2, 2); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*AbsolutePosition:40*\n")); builder.AppendPdf417WithAbsolutePosition(data, 0, 1, Pdf417Level.ECC0, 2, 2, 40); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Center*\n")); builder.AppendPdf417WithAlignment(data, 0, 1, Pdf417Level.ECC0, 2, 2, AlignmentPosition.Center); builder.AppendUnitFeed(32); builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Right*\n")); builder.AppendPdf417WithAlignment(data, 0, 1, Pdf417Level.ECC0, 2, 2, AlignmentPosition.Right); builder.AppendUnitFeed(32); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateData(Emulation emulation, PeripheralChannel channel) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.AppendPeripheral(channel); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateMultipleData(Emulation emulation) { byte[] data = Encoding.UTF8.GetBytes("Hello World.\n"); byte[] dataHalf0 = Encoding.UTF8.GetBytes("Hello "); byte[] dataHalf1 = Encoding.UTF8.GetBytes("World.\n"); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.Append(data); builder.AppendMultiple(2, 2); builder.Append(data); builder.AppendMultiple(1, 1); builder.Append(data); builder.AppendMultiple(data, 2, 2); builder.Append(data); builder.AppendMultiple(dataHalf0, 2, 2); builder.Append(dataHalf1); builder.Append(dataHalf0); builder.AppendMultiple(dataHalf1, 2, 2); builder.AppendMultipleHeight(2); builder.Append(data); builder.AppendMultipleHeight(1); builder.Append(data); builder.AppendMultipleHeight(dataHalf0, 2); builder.Append(dataHalf1); builder.Append(dataHalf0); builder.AppendMultipleHeight(dataHalf1, 2); builder.AppendMultipleWidth(2); builder.Append(data); builder.AppendMultipleWidth(1); builder.Append(data); builder.AppendMultipleWidth(dataHalf0, 2); builder.Append(dataHalf1); builder.Append(dataHalf0); builder.AppendMultipleWidth(dataHalf1, 2); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateTextReceiptData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, bool utf8) { ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); localizeReceipts.AppendTextReceiptData(commandBuilder, utf8); commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreateTextReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt, bool utf8) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); localizeReceipt.AppendTextReceiptData(builder, utf8); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateSoundData(Emulation emulation) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.AppendSound(SoundChannel.No1); builder.AppendSound(SoundChannel.No2); builder.AppendSound(SoundChannel.No1, 3); builder.AppendSound(SoundChannel.No2, 3); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreatePeripheralData(Emulation emulation) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.AppendPeripheral(PeripheralChannel.No1); builder.AppendPeripheral(PeripheralChannel.No2); builder.AppendPeripheral(PeripheralChannel.No1, 2000); builder.AppendPeripheral(PeripheralChannel.No2, 2000); builder.EndDocument(); return(builder.Commands); }
public async static Task <byte[]> CreateScaleRasterReceiptData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, int width, bool bothScale) { Stream stream = await localizeReceipts.CreateScaleRasterReceiptImageAsync(); ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.AppendBitmap(stream, false, width, bothScale); commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreateFileOpenData(Emulation emulation, string filePath, int paperSize) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); Bitmap rasterImage = (Bitmap)Image.FromFile(filePath); builder.AppendBitmap(rasterImage, true, paperSize, true); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateScaleRasterReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt, int width, bool bothScale) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); Bitmap rasterImage = localizeReceipt.CreateScaleRasterReceiptImage(); builder.AppendBitmap(rasterImage, false, width, bothScale); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateCouponData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, int width, BitmapConverterRotation rotation) { Stream stream = localizeReceipts.CreateCouponImage(); ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.AppendBitmap(stream, false, width, true, rotation); commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreateCouponData(Emulation emulation, LocalizeReceipt localizeReceipt, int width, BitmapConverterRotation rotation) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); Bitmap rasterImage = localizeReceipt.CreateCouponImage(); builder.AppendBitmap(rasterImage, false, width, true, rotation); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
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 void Print(List <TicketBase> tickets, int issueingNumber, Action <int> onPrint, Action <Exception, int> onError) { StarPrinterStatus status = port.BeginCheckedBlock(); if (status.Offline) { } ICommandBuilder builder = StarIoExt.CreateCommandBuilder(Emulation.StarGraphic); builder.BeginDocument(); tickets.ForEach((t, i) => { try { int height = 8 * 58 - 85 - 15; // height = 8 * 58 - 25 - 15; Bitmap bmp = t.Bitmap.Clone(new Rectangle((t.Bitmap.Width - 576) / 2, 70, 576, height), t.Bitmap.PixelFormat); builder.AppendBitmapWithAbsolutePosition(bmp, false, 576, false, BitmapConverterRotation.Normal, 0); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); bmp.Dispose(); onPrint(i); } catch (Exception ex) { onError(ex, i); } }); builder.EndDocument(); byte[] command = builder.Commands; uint writtenLength = port.WritePort(command, 0, (uint)command.Length); status = port.EndCheckedBlock(); if (status.Offline) { } }
public static byte[] CreateTextBlackMarkData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, BlackMarkType type, bool utf8) { ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.AppendBlackMark(type); localizeReceipts.AppendTextLabelData(commandBuilder, utf8); commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); // commandBuilder.AppendBlackMark(BlackMarkType.Invalid); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreateRasterReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); Bitmap rasterImage = localizeReceipt.CreateRasterReceiptImage(); builder.AppendBitmap(rasterImage, false); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.AppendPeripheral(PeripheralChannel.No1); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateTextPageModeData(Emulation emulation, LocalizeReceipt localizeReceipt, Rectangle printRegion, BitmapConverterRotation rotation, bool utf8) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.BeginPageMode(printRegion, rotation); localizeReceipt.AppendTextLabelData(builder, utf8); builder.EndPageMode(); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateTextPageModeData(StarIoExtEmulation emulation, LocalizeReceipts.ILocalizeReceipts localizeReceipts, Rectangle rectangle, BitmapConverterRotation rotation, bool utf8) { ICommandBuilder commandBuilder = Extension.CreateCommandBuilder(emulation); commandBuilder.BeginDocument(); commandBuilder.BeginPageMode(rectangle, rotation); localizeReceipts.AppendTextLabelData(commandBuilder, utf8); commandBuilder.EndPageMode(); commandBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); commandBuilder.EndDocument(); return(commandBuilder.Commands); }
public static byte[] CreateBlackMarkData(Emulation emulation, BlackMarkType type) { byte[] data = Encoding.UTF8.GetBytes("Hello World.\n"); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.AppendBlackMark(type); builder.Append(data); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); //builder.AppendBlackMark(BlackMarkType.Invalid); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateInitializationData(Emulation emulation) { byte[] data = Encoding.UTF8.GetBytes("Hello World.\n"); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.Append(data); builder.AppendMultiple(2, 2); builder.Append(data); builder.AppendFontStyle(FontStyleType.B); builder.Append(data); builder.AppendInitialization(InitializationType.Command); builder.Append(data); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateAbsolutePositionData(Emulation emulation) { byte[] data = Encoding.UTF8.GetBytes("Hello World.\n"); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.Append(data); builder.AppendAbsolutePosition(40); builder.Append(data); builder.Append(data); builder.AppendAbsolutePosition(data, 40); builder.Append(data); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateLogoData(Emulation emulation) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); builder.Append(Encoding.UTF8.GetBytes("*Normal*\n")); builder.AppendLogo(LogoSize.Normal, 1); builder.Append(Encoding.UTF8.GetBytes("\n*Double Width*\n")); builder.AppendLogo(LogoSize.DoubleWidth, 1); builder.Append(Encoding.UTF8.GetBytes("\n*Double Height*\n")); builder.AppendLogo(LogoSize.DoubleHeight, 1); builder.Append(Encoding.UTF8.GetBytes("\n*Double Width and Double Height*\n")); builder.AppendLogo(LogoSize.DoubleWidthDoubleHeight, 1); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return(builder.Commands); }
public static byte[] CreateBitmapDataDetail(Emulation emulation) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); String BitmapTitle; Font TitleFont; Bitmap rasterImage; String BitmapDetail; BitmapTitle = "交易明細\n"; TitleFont = new Font("新細明體", 40); rasterImage = CreateBitmapFromString(BitmapTitle, 96.0F, 96.0F, TitleFont, 96); builder.AppendBitmap(rasterImage, false); String DateTime = " " + dr["printtime"] + "\n\n"; Font DateTimeFont = new Font("新細明體", 20); Bitmap rasterImage3 = CreateBitmapFromString(DateTime, 96.0F, 96.0F, DateTimeFont, 0); builder.AppendBitmap(rasterImage3, false); Font DetailFont = new Font("新細明體", 18); string subtitle = "品名/數量\t單價\t金額"; string subtitleWithSpace = CalculateSpaceWidth(subtitle, DetailFont, 96.0F, 96.0F, 20); BitmapDetail = subtitleWithSpace + "\n"; foreach (string productlist in products) { string[] lines = productlist.Split('\n'); foreach (string line in lines) { string productWithSpace = CalculateSpaceWidth(line, DetailFont, 96.0F, 96.0F, 20); BitmapDetail += productWithSpace + "\n"; } } Bitmap rasterImage4 = CreateBitmapFromString(BitmapDetail, 96.0F, 96.0F, DetailFont, 0, true); builder.AppendBitmap(rasterImage4, false); String total = "\n總計:" + new string(' ', 10) + dr["total"] + " 元\n"; Font totalFont = new Font("新細明體", 18); Bitmap rasterImage5 = CreateBitmapFromString(total, 96.0F, 96.0F, totalFont, 0, false); builder.AppendBitmap(rasterImage5, false); builder.AppendUnitFeed(5); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.AppendPeripheral(PeripheralChannel.No1); builder.EndDocument(); return(builder.Commands); }