printing html

  • Thread starter Thread starter PL Patrick
  • Start date Start date
PL Patrick,

There is a function that is exported from MSHTML.DLL that you can use
called PrintHTML. You can run this from the command line like this:

rundll32.exe C:\winnt\system32\mshtml.dll,PrintHTML "%1

You will have to replace "c:\winnt\system32" with your system32
directory. Also, "%1" should be replaced with the HTML file that you want
to print. You can call the static Start method on the Process class to run
this.

If you want something of a more programattic nature, then I would
recommend using the WebBrowser control and then getting the Document
associated with it. The document exposes an implementation of the
IHTMLDocument2 interface, which exposes a parentWindow property. The return
value from this property can be cast to the IHTMLWindow3 interface, which
has a print method you can call to print the document.

Hope this helps.
 
Back
Top