Script Collection
Other
Printing Webpages from Internet Explorer with Python | Printing Webpages from Internet Explorer with Python |
|
|
|
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) |
|
| Last Updated ( Thursday, 02 February 2006 ) |
| < Prev | Next > |
|---|
Hint: For syntax highlighting and correct Python intendation place your code between html tags <pre> and </pre>.