[Zope] Printing from Zope.....Report writer building
Joachim Werner
joachim.werner@iuveno.de
Fri, 24 Mar 2000 13:54:01 +0100
Am Fre, 24 Mär 2000 schrieb Olivier Deckmyn:
> Why not generate a PDF file on the local file system and then print it
> (linux machine) with gs ? (ghostscript)
Same suggestion. How it works (one possible way of doing it):
Using a standard Linux installation, create a document with your data in a
Python method and safe it as a local (temporary) file (e.g. using the PDF tools
that exist for Python, e.g. "PIDDLE"). Then just do the following in your Python
code:
import os
os.system('lpr /path/filename')
This works under Windows, too. Just replace the system call by something
appropriate like "copy path\filename lp1".
It should also be possible to redirect the stdout data stream directly to the
printing device.
I have also found some more sophisticated solutions:
- using the classes wxPrinter and wxPrintout from the wxPython package
- for Windows: using the Printer API directly with
import win32ui
import win32com
... (gets complicated)
Joachim Werner.