PrinterSettings does not take the number of copies

5.2k views Asked by At

I have a question about the PrinterSettings in C#. When i set the PrinterSettings.Copies to 2 on a desktop printer it will print 2 documents.

However when I set the Copies to 2 on a Zebra GK420d Label printer the number of copies I define will be overwritten by the printers default number of copies. The Zebra printer is the only printer that allows me to define the number of copies in the Printer settings (Start -> Devices and Printers -> Printer Properties).

However when I open a PrintDialog and set the number of copies to 2 in there. But if I do it programatically it won't work. Here is my situation:

Form: Printer Settings, When i load the form the following code is executed

ps_Current = new PrinterSettings();
ps_Current.PrinterName = cbPrinters.Text;

This works correctly, the PrinterSettings variable is initiallized and the PrinterName is set to the printer I choose. Then under the Number of copies I have the following:

ps_Current.Copies = (short)seAantalKopieen.Value;

This also works correct (for all the printers except the Zebra printer). Somehow the Zebra printer takes the default printer settings instead of what I put in using my code.

When I change the code to this:

PrintDialog PD = new PrintDialog();
PD.PrinterSettings = ps_Current;
PD.ShowDialog();    
ps_Current = PD.PrinterSettings;

This will give me a PrintDialog screen where I can select the printer and the amount of copies. If i select the Zebra printer in here and change copies to 2 it will work. But I don't want to use the Windows PrintDialog I just want my own print dialog with only:

Printer:
Source:
Amount of copies:

But I can't get it to work.

1

There are 1 answers

0
Kcvin On BEST ANSWER

When you call PD.ShowDialog() you allow the user to change any settings that they want. When the user clicks OK to print the document, the settings that they chose will update the PD.PrinterSettings. You should be able to print two copies by doing:

PrintDialog PD = new PrintDialog();
PD.ShowDialog();    
ps_Current = PD.PrinterSettings;
// Essentially you override what the user chose, which can be frustrating for the user.
ps_Current.Copies = (short)seAantalKopieen.Value;