Skip to main content
Author:

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

Version:
0.8.1
License:

GNU General Public License v3 or later (GPLv3+)

Homepage:

https://gitlab.com/pdftools/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 locale
import ghostscript

args = [
    "ps2pdf", # actual value doesn't matter
    "-dNOPAUSE", "-dBATCH", "-dSAFER",
    "-sDEVICE=pdfwrite",
    "-sOutputFile=" + sys.argv[1],
    "-f",  sys.argv[2]
    ]
ghostscript.Ghostscript(*args)

Here an example for passing a string document to Ghostscript:

# documents passed to ghostscript need to be bytes
doc = b"""%!
/Helvetica findfont 20 scalefont setfont
50 50 moveto
(Hello World) show
showpage
quit
"""

import ghostscript

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

with ghostscript.Ghostscript(*args) as gs:
    gs.run_string(doc)

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

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 pip install ghostscript as usual. Please refer to the manuals of pip for further information.

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

python ./setup.py install

Metadata

Release files for ghostscript 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ghostscript 0.8.1
File Size Uploaded Provenance
ghostscript-0.8.1.tar.gz 28.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ghostscript 0.8.1
File Interpreter ABI Platform
ghostscript-0.8.1-py3-none-any.whl Python 3 none any Details

Total release size: 54.5 kB

Release files / ghostscript-0.8.1.tar.gz

Download URL ghostscript-0.8.1.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7cfa85d201036bf87890e425b4a0cdc9749abc4670a4492ae2aa66ad792b1388
BLAKE2b-256 checksum
How to use checksums
1e4d12eb41060aa530f22f5233bdc3bfa5c3f444c86e2853100cff9781536baa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.11

Release files / ghostscript-0.8.1-py3-none-any.whl

Download URL ghostscript-0.8.1-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a801d1f0e3321d87c394d8c8f7d38e413692474c8a5cab7673b1b7f3a2c4b811
BLAKE2b-256 checksum
How to use checksums
3eef8d76a3cb0fb62757edae6e3e5c9cdbde35402157cbea1b05d0c1b8ddf0c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.11

Security for ghostscript 0.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page