停止在最后一行打印收据

时间:2016-07-07 15:08:59

标签: printing receipt

我有一台bixolon打印机打印销售收据。打印机安装为通用打印机。 问题是打印机在最后一行画出后继续送空纸。以这种方式浪费纸张。 我想找到一种方法来阻止打印机在绘制完最后一行后执行此操作。 我已经尝试过的事情: 改变纸张大小 将hasmorepages设置为false(这不起作用,因为打印机打印整个页面大小是否已满或者只有一个字符)

Graphics g = e.Graphics;

        Font font = new Font("Courier New", 10);

        StringBuilder sb = new StringBuilder();
        sb.AppendLine("Union Caribe N.V.".PadLeft(27));
        sb.AppendLine();
        sb.AppendLine("Date initialized: " + info.Initialized);
        sb.AppendLine("Date finalized: " + info.Finalized);
        sb.AppendLine("Office: " + info.Office);
        sb.AppendLine();

        Transaction transClient = new Transaction();
        foreach (var trans in info.Transactions)
        {
            foreach (Articulo item in trans.Items)
            {
                transClient.AddItem(item);
            }
        }

        foreach (SaleArticulo item in transClient.GetListOfItemsToShow())
        {
            sb.Append(item.Name.PadRight(17));
            sb.Append((item.Amount + "x" + item.Price).PadRight(8));
            sb.AppendLine((String.Format("{0:F0.00}", item.Total)).PadLeft(15));
        }
        sb.AppendLine("----------------------------------------");
        sb.AppendLine(("Total:").PadRight(32) + (String.Format("{0:F0.00}", info.Total)).PadLeft(8));
        sb.AppendLine("----------------------------------------");
        sb.AppendLine();
        sb.AppendLine();
        sb.AppendLine("---------------------------".PadLeft(34));
        sb.AppendLine(("Signature.").PadLeft(25));
        sb.AppendLine((info.FirstName + " " + info.LastName).PadLeft(24));

        PrintText printText = new PrintText(sb.ToString(), font);
        SizeF layoutArea = new SizeF(e.PageSettings.PrintableArea.Width, e.PageSettings.PrintableArea.Height);
        SizeF stringSize = g.MeasureString(printText.Text, printText.Font, layoutArea, printText.StringFormat);
        RectangleF rectf = new RectangleF(new PointF(), new SizeF(e.PageSettings.PrintableArea.Width, stringSize.Height));
        g.DrawString(printText.Text, printText.Font, System.Drawing.Brushes.Black, rectf, printText.StringFormat);

我想在

之后停止打印(打印机)
sb.AppendLine((info.FirstName + " " + info.LastName).PadLeft(24)); line of code.    

非常感谢任何帮助。

0 个答案:

没有答案