From: Mark Hammond on
On 19/07/2010 3:46 AM, python(a)bdurham.com wrote:
> Under Windows: Is there a way to print a file using the file's file
> extension association using either the os.system or subprocess modules
> (vs. win32 extensions)?
> Use case: print PDF or Office documents to default printer without
> having to distribute win32 extensions.
> Thanks,
> Malcolm

You probably want to use the windows ShellExec function with a 'print' verb.

Mark


From: python on
Hi Mark,

> You probably want to use the windows ShellExec function with a 'print' verb.

Thanks Mark! And cheers for the great win32api library!!

I've included a link[1] on how to do this for anyone searching the
archives.

Malcolm

[1] Print via ShellExecute (prints to the user's default printer)
http://timgolden.me.uk/python/win32_how_do_i/print.html#shellexecute

Example:

win32api.ShellExecute( 0, 'print', fileName, None, '.', 0 )

<snipped>
Under Windows: Is there a way to print a file using the file's file
extension association using either the os.system or subprocess modules
(vs. win32 extensions)?

Use case: print PDF or Office documents to default printer without
having to distribute win32 extensions.
</snipped>