Hello,

We are building an application for the Microsoft .net framework (version
2) using the C#
language. A major part of the application requires output to be printed
on to custom paper
size without the user being shown PrintDialog box and having to select
or enter the
required paper size.

The following sample code from the application (variable data have been
replaced by fixed
values for clarity):
/*
* Sample Test code
*/
public void Print()
{
 try
 {
  PrintDocument prnDoc = new PrintDocument();
  prnDoc.PrintPage += new PrintPageEventHandler(OnPrintPage);
  //
  // fixed values used for clarity, real values are depentent
  // on what is being printed.
  //
  PaperSize paperSize = new PaperSize("Custom", 600, 800);
  //
  // Direct print to printer named "Samsung ML-2010 Series"
  // Test code, real code gets name from storage
  //
  prnDoc.PrinterSettings.PrinterName = "Samsung ML-2010 Series";
  //
  // Set half inch margins
  prnDoc.DefaultPageSettings.PaperSize = paperSize;
  //
  // Set half inch margins
  prnDoc.DefaultPageSettings.Margins.Top = 50;
  prnDoc.DefaultPageSettings.Margins.Left = 50;
  prnDoc.DefaultPageSettings.Margins.Right = 50;
  prnDoc.DefaultPageSettings.Margins.Bottom = 50;
  //
  // Set to Landscape
  prnDoc.DefaultPageSettings.Landscape = true;
  //
  // Print the Document
  prnDoc.Print();
 }
 catch (InvalidPrinterException e)
 {
  MessageBox.Show(e.ToString());
 }
 catch (Exception e)
 {
  MessageBox.Show(e.ToString());
 }
}

This code has been tested against a number of printers from different
manufacturers
(Samsung, Brother, HP, Oki...) and virtual printers such as PDFCreator.
All the printers
performed as expected apart from the Samsungs.

The Samsung printers tested (ML-2010 ML-2010R, ML-2250, and ML-2510) do
not change
the paper size and print onto the default size. The margins and page
orientation are set.

Is there any way around this?

Thank you.

Regards,
Gary Harpin
 
________________________________

"...a computer is a stupid machine with the ability to do incredibly
smart things, while computer programmers are smart people with the
ability to do incredibly stupid things. They are, in short, a perfect
match.."  Bill Bryson

 

[No Disclaimer]
 

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to