python-ghostscript
Python-Interface to the Ghostscript C-API
- Author:
Hartmut Goebel <h.goebel@crazy-compiler.com>
- Version:
0.5dev
- 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 my download and unpack the source package of python-ghostscript from http://pypi.python.org/pypi/ghostscript and run:
python ./setup.py install
Metadata
Release files for python3-ghostscript 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distributions (sdists)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python3-ghostscript-0.5.0.zip | 30.2 kB | Without provenance | Details | |
| python3-ghostscript-0.5.0.tar.bz2 | 21.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python3_ghostscript-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 66.3 kB
Release files / python3-ghostscript-0.5.0.zip
| Download URL | python3-ghostscript-0.5.0.zip |
|---|---|
| Size | 30.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41e684238fee9a86dcf6d61e765814cdd33a9986f0fb4ef5d3abbfb20999f66f
|
|
BLAKE2b-256 checksum How to use checksums |
ddbd9b6172d8019680758b16be7b4a98440382af5fc902d7363ae8d557d144ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / python3-ghostscript-0.5.0.tar.bz2
| Download URL | python3-ghostscript-0.5.0.tar.bz2 |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b025cfc001dfa31ab1801ff36774b397fd9d00d548c90bf66293481a3e74628
|
|
BLAKE2b-256 checksum How to use checksums |
554fe58b0b537d1f8ec31f372a5ded7177c70d13bea3a80054cb5b867595eef8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / python3_ghostscript-0.5.0-py3-none-any.whl
| Download URL | python3_ghostscript-0.5.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a474879da1271b1ecab411e17bdafb475b81c288d2cf67f8ff7871354eaa6975
|
|
BLAKE2b-256 checksum How to use checksums |
6a2de2d7474bea24d223d5dc86d51241fd305b75a9168f2e1d7ee07b883c80a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python3-ghostscript 0.5.0
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.