how to print pdf with python on a inkjet printer.
Tim Roberts
timr at probo.com
Fri Nov 17 15:40:57 EST 2006
krishnakant Mane 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.
> that essentially solves my most important problem.
> else I was thinking to create an excel spreadsheet as a last alternative.
> out of my curocity, I want to know if there are libraries that can
> create excel spreadsheets?
There are several ways. One way is to just bring up Excel itself and
send it commands via COM. Several times, I've written my data as a
comma-separated file (which Excel understands), then brought up Excel as
a COM component, loaded the file, then used Excel commands to format the
columns.
There are also a couple of Python modules which purport to be able to
read and write .xls files directly. There's xlrd, but there's a newer
one whose name escapes me. I thought it was a pun, like "xlerator," but
that's not right.
> I also wanted to know if there is a common dialog for listing out
> printers under windows?
> so in future if I make this software in GUI, I can at list help the
> user select the printer from the list.
Yes, there is a standard "print" dialog for Windows that shows you the
familiar dialog, with the list of printers and all of the options. In
wxPython, I believe it is called wx.PrintDialog.
In Pywin32, win32print.EnumPrinters can give you the list of available
printers.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list