Hello Vivek,
Could you please see the following link:
Printing Using C# - Changing the Page Settings[
^]
I have taken following code from it.
Printing Without the Preview
To print to another printer, you have to use the standard print dialog. We can bring this up in much the same way, so add this method to PrintEngine:
public void ShowPrintDialog()
{
PrintDialog dialog = new PrintDialog();
dialog.PrinterSettings = PrinterSettings;
dialog.Document = this;
if(dialog.ShowDialog() == DialogResult.OK)
{
PrinterSettings = dialog.PrinterSettings;
Print();
}
}
Again, if the user clicks OK we save the settings, but this time we also call Print to print directly to the configured printer. Add this event handler to Form1 to finish this off:
private void cmdPrint_Click(object sender, System.EventArgs e)
{
_engine.ShowPrintDialog();
}