Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Postscript printing in Python

145 views
Skip to first unread message

Clement

unread,
Sep 23, 1999, 3:00:00 AM9/23/99
to
Hi Everybody,

I need to do a mail merge to a postscript printer. Does anyone know of
any tools that is available to the Python community?

I checked the libraries and other Python documentation and failed to
find any help on printing to a postscript printer!
--

Regards

Clement

Fredrik Lundh

unread,
Sep 23, 1999, 3:00:00 AM9/23/99
to
Clement <cle...@ans.com.au> wrote:
> I checked the libraries and other Python documentation and failed to
> find any help on printing to a postscript printer!

a few options:

there's PIDDLE:
http://www.strout.net/python/piddle/intro.html

if you have PIL installed, there's a very basic PostScript
driver in there:
http://www.pythonware.com/library/pil/handbook/psdraw.htm

and yes, Tkinter can print the contents of a canvas to a
PostScript printer, and Grail (http://grail.cnri.reston.va.us/grail/)
comes with an HTML to PostScript converter...

</F>


Fred L. Drake, Jr.

unread,
Sep 23, 1999, 3:00:00 AM9/23/99
to

Clement writes:
> I need to do a mail merge to a postscript printer. Does anyone know of
> any tools that is available to the Python community?
>
> I checked the libraries and other Python documentation and failed to
> find any help on printing to a postscript printer!

It's not clear what you want. Can't you just open a connection to
the printer and write to it? The API will differ by platform; on Unix
you'd do something like:

import os
printer = os.popen("lpr", "w")

printer.write("%!PS-Adobe-2.0\n")
...
printer.close()

I imagine you can get some sort of handle to a printer on Windows
that allows similar operations.
On the other hand, you may want something a little higher level.
Grail (http://grail.python.org/) includes support for printing to a
PostScript printer (Unix-style) via an extended "writer" object; see
the formatter module in the standard library for a description of the
interface. It's pretty easy to use, but may not be what you're
looking for. Adapting it to work on Window shouldn't be too hard if
you can get a way to send the PostScript to the printer yourself.


-Fred

--
Fred L. Drake, Jr. <fdr...@acm.org>
Corporation for National Research Initiatives

0 new messages