[win32com] Print html

Bill Scherer Bill.Scherer at VerizonWireless.com
Mon Aug 14 07:45:03 EDT 2000


Alex Martelli wrote:

> "Bill Scherer" <Bill.Scherer at VerizonWireless.com> wrote in message
> news:39945697.F47A13EE at VerizonWireless.com...
> > Hello,
> >
> > I'm looking for a way to automate printing html on win32 with python.
> > Currently, I'm able to load IE5 as a com object and get it to load a
> > document.
> > I can get the document object from the IE5 object.
> > Neither object seems to have a print method of any kind.
> > Any ideas?
>
> IWebBrowser2::ExecWB takes as its first parameter the
> OLECMDID (numeric code) of the command you want IE to
> execute.

OK, where does  IWebBrowser2 com from?
This is how I get my handle to IE:
    I ran makepy.py for shdocvw.dll
    import win32com.client
    ie = win32com.client.Dispatch("InternetExplorer.Application.1")

While I'm at it, navigating and getting a doc is like so:
    ie.Navigate("<some uri>")
    doc = ie.Document


>
>
> OLECMDID_PRINT =  6 is the one you want.
>
> The second parameter encodes the options; for example,
> OLECMDEXECOPT_DONTPROMPTUSER = 2 to proceed without a
> confirmation prompt to the user.
>

These constants are definded in the module generated by makepy...


>
> I think you don't need to specify the 3rd and 4th
> parameters, but, do experiment.
>
> Alex
>
> --
> http://www.python.org/mailman/listinfo/python-list

--
William K. Scherer
Sr. Member of Applications Staff - Verizon Wireless
Bill.Scherer_at_VerizonWireless.com







More information about the Python-list mailing list