【问题标题】:How to send cut command in Thermal Printer using PrintDocument in c#如何在 C# 中使用 PrintDocument 在热敏打印机中发送剪切命令
【发布时间】:2019-05-29 14:13:40
【问题描述】:

我正在使用PrintDocument 打印账单内容。但我无法发送自动剪切命令。我正在使用下面的代码来打印内容。

PrintDocument printDocument = new PrintDocument();
printDocument.PrintPage += PrintDocumentOnPrintPage;
printDocument.PrinterSettings.PrinterName = "TestPrinter";
printDocument.Print();
printDocument.Dispose();

谁能帮我自动剪切必须使用哪个命令?

【问题讨论】:

标签: c#


【解决方案1】:

我尝试了以下两个代码块的组合

PrintDocument printDocument = new PrintDocument();
printDocument.PrintPage += PrintDocumentOnPrintPage;
printDocument.PrinterSettings.PrinterName = "TestPrinter";
printDocument.Print();
printDocument.Dispose();

最后,我发送以下命令,它对我来说工作正常

        string GS = Convert.ToString((char)29);
        string ESC = Convert.ToString((char)27);
        string documentName ="x"

        string COMMAND = this.textBox.T`ext;
        COMMAND = ESC + "@";
        COMMAND += GS + "V" + (char)1;
        RawPrinterHelper.SendStringToPrinter(this.textBox1.Text, COMMAND,documentName);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-20
    • 2017-02-03
    • 1970-01-01
    • 2011-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-19
    相关资源
    最近更新 更多