This script calls the webpage www.heise.de in Internet Explorer and prints it to the standard printer.
Attention: use the makepy.py utility (C:\\Python23\\Lib\\site-packages\\win32com\\client\\) on the “Microsoft Internet Controls (1.1)” object library to get early binding !!! Otherwise you cannot print !
# print a webpage in Internet Explorer (COM Example) # Attention: use the makepy utility for the "Microsoft Internet Controls (1.1)" # object library to get early binding !!!
from win32com.client import Dispatch
from time import sleep
ie = Dispatch(“InternetExplorer.Application”)
ie.Visible = 1
ie.Navigate(“http://www.heise.de”)
if ie.Busy:
sleep(2)
# print the current IE document without prompting the user for the printerdialog
ie.ExecWB(win32com.client.constants.OLECMDID_PRINT, \
win32com.client.constants.OLECMDEXECOPT_DONTPROMPTUSER)