Solved

WebBrowser Control (Printing)

Posted on 2006-11-16
6
203 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
 
LVL 8

Expert Comment

by:kaliyugkaarjun
ID: 17963945
0

Featured Post

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!

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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