printing HTML or PDF from Python

Daniel Dittmar daniel.dittmar at sap.corp
Tue Oct 26 12:07:32 EDT 2004


Donnal Walter wrote:
> We want to be able to print HTML or PDF files to a given printer from 
> Python in a kind of batch mode (without opening a preview window or 
> printer dialog for each file). The printer is on a network, but for 

os.system ('"C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe"'  + 
' /p /h ' + yourpdf)

This still brings up an empry Adobe Reader window.

General Strategy:
- does right-click on such a file shows a Print entry?
- if yes, try to find the definition for that entry in the registry
- HKEY_CLASSES_ROOT/.html => htmlfile
- look for HKEY_CLASSES_ROOT/htmlfile/shell/Print/command

Doing this using the _winreg module is left as an exercise.

I guess the command line options for Acrobat are the same on Linux (-p -h).

Mozilla doesn't seem to have a command line option to print 
(http://www.mozilla.org/docs/command-line-args.html).

Daniel



More information about the Python-list mailing list