J
John Smith
Hey folks,
I'm trying to print from a c# windows application using
System.Drawing.Printing. My problem is that it doesn't matter what I put in
for papersize, it always ignores what I tell it and always prints out the
same thing. Landscape works though. Does anyone see any problems with this
code?
printDoc.PrinterSettings.PrinterName = configSettings.labelPrinterName;
printDoc.DefaultPageSettings.Landscape = true;
printDoc.DefaultPageSettings.PaperSize.Width = 350;
printDoc.DefaultPageSettings.PaperSize.Height = 700;
printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
printDoc.Print();
:
:
private void printDoc_PrintPage(Object sender, PrintPageEventArgs e)
{
e.PageSettings.PaperSize.Width = 350;
e.PageSettings.PaperSize.Height = 700;
e.PageSettings.Landscape = true;
Font printFont = new Font("Arial", 10, System.Drawing.FontStyle.Bold);
e.Graphics.DrawString(strTextToPrint, printFont, Brushes.Black, 0, 0);
}
I'm trying to print from a c# windows application using
System.Drawing.Printing. My problem is that it doesn't matter what I put in
for papersize, it always ignores what I tell it and always prints out the
same thing. Landscape works though. Does anyone see any problems with this
code?
printDoc.PrinterSettings.PrinterName = configSettings.labelPrinterName;
printDoc.DefaultPageSettings.Landscape = true;
printDoc.DefaultPageSettings.PaperSize.Width = 350;
printDoc.DefaultPageSettings.PaperSize.Height = 700;
printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
printDoc.Print();
:
:
private void printDoc_PrintPage(Object sender, PrintPageEventArgs e)
{
e.PageSettings.PaperSize.Width = 350;
e.PageSettings.PaperSize.Height = 700;
e.PageSettings.Landscape = true;
Font printFont = new Font("Arial", 10, System.Drawing.FontStyle.Bold);
e.Graphics.DrawString(strTextToPrint, printFont, Brushes.Black, 0, 0);
}