Announcing:
python-ghostscript 0.7
A Python-Interface to the Ghostscript C-API using ctypes
:License: GNU General Public License v3 or later (GPLv3+) :Author: Hartmut Goebel h.goebel@crazy-compiler.com :Homepage: https://gitlab.com/pdftools/python-ghostscript :Download: https://pypi.python.org/pypi/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.
__ http://www.ghostscript.com/ __ http://docs.python.org/library/ctypes.html
This package is currently tested only under GNU/Linux. Please report whether it works in your environment, too. Thanks.
Changes since last release ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* BREAKING: ``Ghostscript()`` no longer allows passing arbitrary keyword arguments.
* The high-level interface now allows passing unicode strings as arguments. Passing bytes as arguments is still possible, but now deprecated.
* The high-level interface now requires ghostscript >= 9.0.8 (released 2013-08-14).
* Allow multiple Ghostscript instances. Actually using this requires the library is compiled with -DGS_THREADSAFE.
* Ensure proper clean-up on error.
* High-level revision() now returns unicode strings instead of byte strings.
* Add low-level interface for set_arg_encoding().
* Miscellaneous small fixes.
* Drop support for Python 2.7, 3.4 and 3.5. Minimum required Python version is now 3.6.
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)
python-announce-list@python.org