- Version:
- 0.4
- Copyright:
- GNU Public License v3 (GPLv3)
- Homepage:
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)
Here an example for passing a string document to Ghostscript:
doc = """%!
/Helvetica findfont 20 scalefont setfont
50 50 moveto
(Hello World) show
showpage
"""
import ghostscript
args = """test.py
-dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=/tmp/out.pdf
-c .setpdfwrite""".split()
GS = ghostscript.Ghostscript(*args)
try:
GS.run_string(doc)
finally:
GS.exit()
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 may download and unpack the source package of python-ghostscript from http://pypi.python.org/pypi/ghostscript and run:
python ./setup.py install
Release files for ghostscript 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distributions (sdists)
| File | Size | Uploaded | |
|---|---|---|---|
| ghostscript-0.4.zip | 41.7 kB | Details | |
| ghostscript-0.4.tar.bz2 | 27.2 kB | Details |
Release files / ghostscript-0.4.zip
| Download URL | ghostscript-0.4.zip |
|---|---|
| Size | 41.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43ab6ca6c19aefac3b805d55341965c24369d559e8b430b986308130a5a11db4
|
|
BLAKE2b-256 checksum How to use checksums |
bb5c82786ac6a36fbbb17977f641f14cbb958cdbc19ba06f9f46df1d1fa409c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ghostscript-0.4.tar.bz2
| Download URL | ghostscript-0.4.tar.bz2 |
|---|---|
| Size | 27.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47224e21083ee82f57d737895ac2dafa20db1a059dd5ab53e0562f7fb9ea572c
|
|
BLAKE2b-256 checksum How to use checksums |
6e9593b7b64f742b7ec980c5a4841353ebd823aaec1928e3f07e9e760fe75d12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |