Do Thanh Tung
Do Thanh Tung

Reputation: 1323

WinForms C# Add PrinterSetting Values before show PrintDialog

I want to add all PrinterSetting values before show PrintDialog from WinForms. Exampale: I want to set copies = 4 :

PrintDialog.PrinterSettings.Copies = 4;
DialogResult result = PrintDialog.ShowDialog();

But copies showed still be 1. How can I do?

Upvotes: 0

Views: 208

Answers (1)

Carl Reid
Carl Reid

Reputation: 781

Do so by assigning PrintSettings to an instance of PrintDialog.

using (var printDialog = new PrintDialog())
{
    var printSettings = new PrinterSettings {Copies = 4};
    printDialog.PrinterSettings = printSettings;
    printDialog.ShowDialog();
}

This results in the following dialog. enter image description here

Upvotes: 2

Related Questions