Using Ghostscript DLL via ctypes in Py2.3/Win

Adam Twardoch atwardoch at op.pl
Wed Jul 6 11:36:31 CEST 2005


I've written a simple commanline wrapper for calling GhostScript from 
Python. It uses os.system under Windows and os.popen under unixes. The call 
looks basically like this:

gs -q -dNODISPLAY -dNOPAUSE -dSAFER ps2ai.ps infile.eps >outfile.ai

I'd prefer to use the GhostScript DLL API* and call it using ctypes under 
Windows. This way, I could package just the DLL with my application and the 
user would not necessarily need to install the full GhostScript. However, I 
don't really know how to handle ctypes very well.

Has anyone perhaps written something like that already and cares to share a 
code snippet?

Regards,
Adam

*) http://www.cs.wisc.edu/~ghost/doc/cvs/API.htm





More information about the Python-list mailing list