Program select printer to print from WebBrowser component

0 like 0 dislike
6 views
Good time of day!

need to programmatically print the document in the WebBrowser, and the printer is the default printer on the system.
How to programmatically invoke a dialog for selecting the printer know software to choose.
How to programmatically change the default printer, and then to return to the place also know (this now works) but I would like not changing the default printer.
It is clear that how to print, too.

Ideally, we would like to associate WebBroser and System.Drawing.Printing.PrintDocument in which the printer selection is not questioned.

Tell me, maybe someone already butted with this problem.

Thank you.
by | 6 views

4 Answers

0 like 0 dislike
Hello,
\r
If I understand correctly you need from the page loaded in the WebBrowser control to send a command in C# code to configure the printer and make a print. If so, then you have the question is how to call this code from the page. See here. The printer is specified via the property System.Drawing.Printing.PrintDocument.PrinterSettings.PrinterName, without dialogue.
\r
Or specify exactly what you want.
by
0 like 0 dislike
The idea is to use JavaScript to send document to print from the WebControl on desired printer work in the sharp smells great crutch, I'm not talking that every document will have this script stuff.
Maybe I'm not good enough described the challenge:
The main idea, while in sharp to load in the WebBrowser control the html page and send it to the printer while at the same time, the sharp. Using JavaScript of course you can, but it hurts like all fucked up smells. And how do You imagine the setting of the printer through the System.Drawing.Printing.PrintDocument.PrinterSettings.If PrintDocument PrinterName and document in WebBrowser not connected in any way?
by
0 like 0 dislike
It seems I was too quick to advise PrintDocument. Also found a way for you through changing the default printer. Do not tell me this works how stable or just have a desire to do more right?
by
0 like 0 dislike
First and foremost, it's just ugly. Secondly, change the default printer there is always a delay (especially on the first call). Have to do a loop polling and waiting for change to happen. Again, hypothetically, if someone wants to print in parallel and waits for another printer by default, etc. The project is a serious and crutches do not want to write.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked Mar 20, 2019 by piterforman
0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
32,926 users