我正在开发一个需要打印标签的应用程序。我使用的标签打印机是Brother QL-570。标签宽度为66毫米,标签长度需要大约45毫米。我遇到的问题是无法配置应用程序来打印标签。每次我尝试打印标签时,都会收到警告,指出文档大小对于该打印机来说太大了。无论我尝试将PrintDocument大小更改为什么大小,我始终会收到警告,指出文档大小是90mm x 29mm,对于标签打印机来说太大了。
以下是我的一次尝试:
以下是我的一次尝试:
private PrintDocument label;
label = new PrintDocument();
PaperSize pS = new PaperSize("Custom Size", 212, 67);
label.DefaultPageSettings.PaperSize = pS;
label.PrinterSettings.PrinterName = "Brother QL-570";
label.PrinterSettings.DefaultPageSettings.PaperSize = pS;
label.PrintPage += new PrintPageEventHandler(label_PrintPage);
private void label_PrintPage(object sender, PrintPageEventArgs e)
{
SolidBrush brush = new SolidBrush(Color.Black);
Font header = new Font(FontFamily.GenericSansSerif, 12.0F, FontStyle.Bold);
e.Graphics.DrawString("Hello World", header, brush, 30, 30);
}
有没有人知道我哪里出了问题?我认为我可能错误地设置了文档和打印机的纸张大小。 我已经尝试了许多其他纸张大小,但都没有成功。
谢谢您的任何帮助。
new PaperSize("自定义尺寸", 212, 67);
? - Peter Ritchie