1. htgoebel
  2. python-ghostscript


python-ghostscript /

Filename Size Date modified Message
135 B
Updated .hgignore
212 B
Added tag release 0.4 for changeset 46bd468c50a7
1.2 KB
Preparing the python-ghostscript 0.4 release.
34.3 KB
Initial checking and preparing release 0.1
137 B
Updated MANIFEST.in to exclude .hgignore anf .hgtags from distribution-archives
3.2 KB
Post-release version bump
388 B
bitbucket logo is 35x35 ans crops funny, so create logo as *we* like it
19.3 KB
Made projectloga quite a bit light-colored
276 B
Removed 'upload' to some setup.py aliases
2.1 KB
Post-release version bump


Author: Hartmut Goebel <h.goebel@crazy-compiler.com>
Version: 0.5dev
Copyright: GNU Public License v3 (GPLv3)

Ghostscript, is a well known interpreter for the PostScript language and for PDF. This package implements a interface to the Ghostscript C-API using ctypes. Both a low-level and a pythonic, high-level interface are provided.

This package is currently tested only under GNU/Linux. Please report whether it works in your environment, too. Thanks.


Here is an example for how to use the high-level interface of python-ghostscript. This implements a very basic ps2pdf-tool:

import sys
import ghostscript

args = [
    "ps2pdf", # actual value doesn't matter
    "-dNOPAUSE", "-dBATCH", "-dSAFER",
    "-sOutputFile=" + sys.argv[1],
    "-c", ".setpdfwrite",
    "-f",  sys.argv[2]


Here an example for passing a string document to Ghostscript:

doc = """%!
/Helvetica findfont 20 scalefont setfont
50 50 moveto
(Hello World) show

import ghostscript

args = """test.py
     -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=/tmp/out.pdf
     -c .setpdfwrite""".split()

GS = ghostscript.Ghostscript(*args)

More examples can be found in the examples subdirectory of the distribution archive.

Requirements and Installation

Please note:This package is meant for developers. Even if there are some usable examples included, installations instructions are meant for developers.

python-ghostscript requires

  • Python 2.3 or higher (tested with Python 2.6)
  • ctypes when using Python 2.3 or 2.4 (ctypes is already included in Python 2.5 and higher)
  • setuptools or distribute for installation (see below).
  • Ghostscript Version 8.x

Installing python-ghostscript

Since this package is meant for developers, we assume you have experience in installing Python packages.

python-ghostscript is listed on PyPI (Python Package Index), so you can install it using easy_install or pip as usual. Please refer to the manuals of easy_install resp. pip for further information.

Alternatively you my download and unpack the source package of python-ghostscript from http://pypi.python.org/pypi/ghostscript and run:

python ./setup.py install