Skip to main content

Interface to the Ghostscript C-API, both high- and low-level, based on ctypes

Project description

Author:

Hartmut Goebel <h.goebel@crazy-compiler.com>

Version:
Version 0.2
Homepage:

http://bitbucket.org/htgoebel/python-ghostscript

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.

Example

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",
    "-sDEVICE=pdfwrite",
    "-sOutputFile=" + sys.argv[1],
    "-c", ".setpdfwrite",
    "-f",  sys.argv[2]
    ]

ghostscript.Ghostscript(*args)

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 may download and unpack the source package of python-ghostscript from http://pypi.python.org/pypi/ghostscript and run:

python ./setup.py install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

ghostscript-0.2.zip (32.8 kB view details)

Uploaded Source

ghostscript-0.2.tar.bz2 (19.6 kB view details)

Uploaded Source

File details

Details for the file ghostscript-0.2.zip.

File metadata

  • Download URL: ghostscript-0.2.zip
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ghostscript-0.2.zip
Algorithm Hash digest
SHA256 172893d99ed7ab7f7617bd2a62d6c70ba7c37be12024d2ec375f2ce959ef4562
MD5 65a5848f729f1b2a38c28c53b1467012
BLAKE2b-256 9093e5e26db21f4dff229402df90f602e43f66e119648f20cfd97a9c5f2712f3

See more details on using hashes here.

File details

Details for the file ghostscript-0.2.tar.bz2.

File metadata

  • Download URL: ghostscript-0.2.tar.bz2
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ghostscript-0.2.tar.bz2
Algorithm Hash digest
SHA256 58dd1ad6fec28fd719ab73a6f018b9703e9747c3961726b1e89d766bddd6c0d0
MD5 5e8850e79ac845f766f72176d0d71a48
BLAKE2b-256 c4cc5221e2ff9014923eb5b6d52d936f66ed68c1e7b5d4f8c8d34db0d10248ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page