Programmatically select a printer in PrintDialog

15,012

Solution 1

Not quite sure,but print dialog has printer settings related properties where you can define the default printer.

Here is somewhat similar question asked in SO, the only difference being it was asked for windows. Neverthless, PrintDialog works in a similar fashion in web too.

Solution 2

You can do like, this,

printDocument.PrinterSettings.PrinterName = "YOUR_PRINTER";

Refer, https://andres.jaimes.net/65/how-to-choose-a-printer-using-c-sharp/

Share:
15,012
Jake J
Author by

Jake J

Updated on June 18, 2022

Comments

  • Jake J
    Jake J almost 2 years

    I have a Web Browser control in Windows forms. It loads a HTML file. I want to be able to give an option to the user to Save this as PDF file.

    If the user has "CutePDF Writer" installed then I thought I can just select it programmatically from Print Dialog and Save it as PDF. I am showing the PrintDialog using Web_browser_control.ShowPrintDialog(). Is there a way to select a printer(CutePDF Writer in my case) programmatically in this Print Dialog without user intervention?