Printing html in vb.net

rdthomps

New member
Joined
Jun 5, 2003
Messages
1
Sampe code to print HTML not just txt ???

I see the sample code posted for printing a .txt file, but what about printing an HTML file?

I need a way to do the same thing, only print an HTML file?

Is there a way to do this, like hosting an HTML control then doing a print-preview, then print?

Of course, I could call IE, but the user might have a different browser chosen for default and that can cause some dependencies.

Anyway to do same as code below but for HTML?
 
Nope. The best youll find is hosting IE and calling some method on that to make it print.
 
I dont think IE exposes a Print Method because Microsoft is really stupid sometimes, the user is the only one who can print the HTML page unless you write your own Web Browser Control.
 
Try

AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER)

AxWebBrowser1 being the name of the Web Browser Control
 
Thats a sure thing, but what about if I want to print on another printer then the default one? Or if this cant be done, how to change the default printer?
 
Back
Top