Solved

WebBrowser Control (Printing)

Posted on 2006-11-16
6
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Accepted Solution

by:
kaliyugkaarjun earned 50 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

626 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