[ANN] python-ghostscript 0.6
Hartmut Goebel
h.goebel at crazy-compilers.com
Tue Jan 16 17:40:17 EST 2018
I'm pleased to announce the new release vor python-ghostscript:
python-ghostscript 0.6
A Python-Interface to the Ghostscript C-API using ctypes
:License: GNU Public License v3 (GPLv3)
:Author: Hartmut Goebel <h.goebel at 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.
Latest Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please note: Version 0.5 has been skipped to avoid version conflicts
with the fork `python3-ghostscript`. All changes of that fork are
integrated into this release.
* Add support for Python 3.x (tested with Python 3.4).
Minimum required Python version is now 2.7.
* Add support for display callback and an example program
using it. Thanks to Lasse Fister.
* Add context-interface (for the ``with``-statement).
* ``GhostscriptError`` now has an attribute ``code`` holding
the numeric error-code.
* ``Ghostscript()`` now accepts keyword-arguments ``stdin``,
``stdout``, ``stderr`` for setting the respective stream. This was
already implementd in version 0.4.1, but not documented.
* Add unittest suite (using pytest).
* Several bug fixes and smaller changes.
* Switch version control to git and move project to gitlab. See
Readme-file for the new URL.
* Set up continuous integration tests.
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)
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel at crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
More information about the Python-list
mailing list