• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

WebBrowser Control (Printing)

Hello,

How to print the webbrowser control without showing the print dialog (select the printer and send it directly to print from my code)

C# .Net 2.0
VisualStudio 2005


Thanks,
0
amrelgarhy81
Asked:
amrelgarhy81
  • 3
  • 2
1 Solution
 
ozymandiasCommented:
Do you mean print the document loaded into the webBrowser or actually print the webBrowser control itself - like a screen shot ?
0
 
amrelgarhy81Author Commented:
No no
Print the contents of the webbrowser,
Like print the yahoo page that open in the webbrowser
NOT a screenshoot
0
 
kaliyugkaarjunCommented:
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
kaliyugkaarjunCommented:
Also chk this..

There are three methods for doing this.

1. Sending ^p key, using SendKeys, which is not really clean programming :P

2. Using the shell command, and rundll32

Shell "rundll32.exe C:\WINDOWS\SYSTEM\MSHTML.DLL,PrintHTML " & _ "http://www.developerfusion.com" , vbMinimizedFocus

3. Finally, method 3, which I think is the best method, and uses the built-in commands for the web-browser.

Private Sub PrintUserPage()
'navigate to the page you want
'you can delete this if you want to print the current page
WebBrowser1.Navigate ("http://www.developerfusion.com/")

DoEvents
'print
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
'you can change OLECMDEXECOPT_DONTPROMPTUSER to OLECMDEXECOPT_PROMPTUSER if you wish

End Sub
0
 
amrelgarhy81Author Commented:
ExecWB dosenot exist in the Webbrowser Control in .Net 2.0
How to get it?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now