Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WebBrowser Control (Printing)

Posted on 2006-11-16
6
Medium Priority
?
207 Views
Last Modified: 2010-04-16
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
Comment
Question by:amrelgarhy81
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:ozymandias
ID: 17954429
Do you mean print the document loaded into the webBrowser or actually print the webBrowser control itself - like a screen shot ?
0
 
LVL 1

Author Comment

by:amrelgarhy81
ID: 17954448
No no
Print the contents of the webbrowser,
Like print the yahoo page that open in the webbrowser
NOT a screenshoot
0
 
LVL 8

Expert Comment

by:kaliyugkaarjun
ID: 17963746
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 8

Accepted Solution

by:
kaliyugkaarjun earned 200 total points
ID: 17963755
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
 
LVL 1

Author Comment

by:amrelgarhy81
ID: 17963783
ExecWB dosenot exist in the Webbrowser Control in .Net 2.0
How to get it?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question