how to print pdf with python on a inkjet printer.
Thomas Heller
theller at ctypes.org
Sun Nov 19 11:11:50 EST 2006
Gabriel Genellina schrieb:
> At Friday 17/11/2006 17:40, Tim Roberts wrote:
>
>> > double wow! as it is my customer wants me to print to the default
>> > printer.
>> > can you please help me with the command for rendering the pdf to the
>> > printer with acrobat using python?
>>
>>You'll have to use the registry to find "acrord32", but once you find
>>it, you just do:
>> os.system( "\\Program Files\\Adobe\\Acrobat 7.0\\Reader\acrord32.exe
>>/p xxx.pdf" )
>>The /p switch requests printing.
>
> Or just let Windows do the dirty work of locating Adobe Reader,
> figuring out the parameters and such:
>
> import win32api
> win32api.ShellExecute(0, "print", path/to/document.pdf, None, None, 0)
>
Note that in Pyhton2.5, os.startfile was extended to accept an optional
second parameter; so
os.startfile(path/to/document.pdf, "print")
should also work.
Thomas
More information about the Python-list
mailing list