C# – Label Printing From C# – Document Size Is Too Large For Printer

cprinting

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.

Here's just one of my attempts:

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.

Thanks For Any Help.

Best Answer

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.

Related Topic