从 C# 打印标签 - 文档尺寸对于打印机来说太大 [英] Label Printing From C# - Document Size Is Too Large For Printer

查看:109
本文介绍了从 C# 打印标签 - 文档尺寸对于打印机来说太大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个必须打印标签的应用程序.我使用的标签打印机是 Brother QL-570.标签宽度为 66 毫米,标签长度需要约为 45 毫米.我遇到的问题是我无法配置应用程序来实际打印标签.每次这样做时,我都会收到一条警告,指出文档尺寸对于打印机来说太大了.无论我尝试将 PrintDocument 尺寸更改为什么尺寸,我总是收到一条警告,指出该文档为 90 毫米 x 29 毫米,对于标签打印机来说太大了.

I'm developing an application which must print labels. The label printer i'm using is a Brother QL-570. The label width is 66mm and the length of the labels needs to be approximately 45mm. The problem I'm having is that I am unable to configure the application to actually print the labels. Everytime I do so I receive a warning stating that the document size is too large for the printer. No matter what size I attempt to change the PrintDocument size to I always receieve a warning stating that the document is 90mm x 29mm and is too large for the label printer.

这只是我的尝试之一:

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);

}

有谁知道我哪里出错了?我想我可能没有正确设置文档和打印机的纸张尺寸.我尝试了许多其他纸张尺寸,但都无济于事.

Has anyone any idea where I'm going wrong? I think I may be setting up the paper size for both the document and the printer incorrectly. I've tried numerous other paper sizes and to no avail.

感谢您的帮助.

推荐答案

问题不是编程问题,而是打印机配置问题.默认情况下,打印机配置为使用与我使用的纸张尺寸不同的纸张尺寸.感谢您的所有帮助.

The problem was not a programming problem but a printer configuration problem. By default the printer was configured to use a different paper size other than the one I was using. Thanks for all your help.

这篇关于从 C# 打印标签 - 文档尺寸对于打印机来说太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆