[python-win32] Re: Automating IE

Thomas Heller theller at python.net
Thu Feb 26 04:25:52 EST 2004


Tim Golden <tim.golden at viacom-outdoor.co.uk> writes:

> Shitiz Bansal [mailto:shitizb at yahoo.com]
>
>> Hi,
>> Thanx, ur code worked out.
>> However it didnt solve my problem.
>> Actually I was trying to print a pdf file 
>> programatically and copied the following code from internet
>
> [... snip code ...]
>
> If all you're trying to do is to to print from Acrobat,
>  then (at least on Acro4) you can call the reader executable
>  (acrord32.exe) you can pass a command-line switch of /p,
>  meaning print, or /t, meaning print to default printer.
>
> However, I believe that these switches are being deprecated
>  in later versions, so your mileage may vary.
>
> Example:
>
> "c:\program files\adobe\Acrobat 4.0\Reader\acrord32.exe" /p doc.pdf
>

Or, call ShellExecute directly.

from ctypes import *
windll.shell32.ShellExecuteA(None, "print", "doc.pdf", None, None, 0)

See also:
<http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp>

Thomas




More information about the Python-win32 mailing list