Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically select a printer in PrintDialog

Tags:

c#

printing

pdf

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?

like image 770
Jake J Avatar asked Jun 24 '26 11:06

Jake J


1 Answers

You can do like, this,

printDocument.PrinterSettings.PrinterName = "YOUR_PRINTER";

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

like image 164
Aniket Bhansali Avatar answered Jun 26 '26 01:06

Aniket Bhansali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!