WebBrowser print to specified printer

  • Thread starter Thread starter Andrius B.
  • Start date Start date
A

Andrius B.

Hi all.

I'd like to print the document from WebBrowser to the specified printer, but
silently, t.i., not by calling ShowPrintDialog. The printer could be the
default system printer, but not in always. Accordingly, using
WebBrowser.Print() is not the solution.
I found one solution: change the system default printer to desired one, do
the print job and then change back the default printer to previous. Tha
problem is, that the user, who uses my app, may not have enough rights to
make some system changes.

Is there another method how to do it silently? Is there any other control
instead of WebBrowser for that purpose?

Thanks for any answer.
 
Hi all.

I'd like to print the document from WebBrowser to the specified printer, but
silently, t.i., not by calling ShowPrintDialog.  The printer could be the
default system printer, but not in always. Accordingly, using
WebBrowser.Print() is not the solution.
I found one solution: change the system default printer to desired one, do
the print job and then change back the default printer to previous. Tha
problem is, that the user, who uses my app, may not have enough rights to
make some system changes.

Is there another method how to do it silently? Is there any other control
instead of WebBrowser for that purpose?

Thanks for any answer.

You can try using PrinterSettings.PrinterName to specify a printer to
print through. Then try calling print method as in the example linked
below:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings.printername.aspx

Note: You alsa may want to loop through InstalledPrinters to see the
exact name of desired printer:
http://msdn.microsoft.com/en-us/lib...inting.printersettings.installedprinters.aspx

HTH,

Onur Güzel
 
Hi. Merhaba. :)

Thanks for the suggestion.
But that example on MSDN is how to print text file.
In may app, I have to print file of html format, witch includes table with
borders. I would like not to handle any print events, like in that example.
It would be event more complicated to draw letters and lines and so on. I
would like to simple use Print() method of PrintDocument object. Is it
possible?

Thanks again.





Hi all.

I'd like to print the document from WebBrowser to the specified printer,
but
silently, t.i., not by calling ShowPrintDialog. The printer could be the
default system printer, but not in always. Accordingly, using
WebBrowser.Print() is not the solution.
I found one solution: change the system default printer to desired one, do
the print job and then change back the default printer to previous. Tha
problem is, that the user, who uses my app, may not have enough rights to
make some system changes.

Is there another method how to do it silently? Is there any other control
instead of WebBrowser for that purpose?

Thanks for any answer.

You can try using PrinterSettings.PrinterName to specify a printer to
print through. Then try calling print method as in the example linked
below:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings.printername.aspx

Note: You alsa may want to loop through InstalledPrinters to see the
exact name of desired printer:
http://msdn.microsoft.com/en-us/lib...inting.printersettings.installedprinters.aspx

HTH,

Onur Güzel
 
Back
Top