Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print HTML through VB App

Status
Not open for further replies.

Gimly

Programmer
Jan 5, 2003
26
ZA
Hi all,

I have a program that "pulls" a HTML file into the browser. The only buttons on the browser that are activated are the forward, back, stop and refresh buttons.

I would like to insert a print button onto that form, that prints the HTML file without the user having to right click on the HTML file and select print.

I do get the common dialog control to print, but it does not print the HTML page, it only prints the path to the html file.

The code I have is the following:
********************************

CD1.cancelerror = true

on error goto errhandler

cd1.showprinter
beginpage = cd1.frompage
endpage = cd1.topage
numcopies = cd1.copies
orientation = cd1.orientation

For i = 1 to numcopies
printer.print

''What do i have to insert here'?

printer.enddoc
next
exit sub
errhandler:
exit sub

*****************************************

If any of you can help me it will be greatly appreciated.

Regards and Thanx
Gimly
 
This is what you need to do to print the HTML to the default printer:

WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0

The constants are exposed by the webbrowser control.

VBrit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top