无法停止打印

时间:2012-03-23 17:57:41

标签: c# printing barcode

我使用this device打印条形码,但打印机不会停止打印,在我关闭之前给我空标签。我发现this question但指定纸张尺寸对我没有帮助。

我使用的代码:

PrintDocument document = new PrintDocument();
document.DefaultPageSettings.PaperSize =
    new PaperSize("Custom", Centimeters(7), Centimeters(5));
document.PrintPage += (s, a) =>
{
    a.Graphics.DrawString("*123456*",
                          BarcodeFont,
                          new SolidBrush(Color.Black),
                          new Point(0, 0));
}
document.Print();

厘米方法:

// Converts the unit "Hundredths of an inch" to centimeter.
int Centimeters(int centimeters)
{
    return (int)((centimeters * 100) / 2.54);
}

它正确地将条形码打印到第一个标签,但它不会停止。标签是7x5厘米。我根据这个设置纸张大小,我不知道我还能做什么。

编辑:将HasMorePages设置为false没有帮助,我知道这不是因为我使用的设备:我目前使用其他一些程序来打印条形码,但它们都有效。

1 个答案:

答案 0 :(得分:5)

HasMorePages的{​​{1}}属性设置为false:

eventArgs