PostScript libraries
Reading PostScript means running it, and almost every library that reads PostScript uses Ghostscript to do it. Ghostscript is licensed under the AGPL-3.0 (or a commercial license from Artifex): if you ship it inside a closed-source program or run it in a network service, check the license first. Libraries that only write PostScript (cairo, xmlgraphics-commons, canvas) don’t need Ghostscript.
| Language | Library | Read | Write | Notes |
|---|---|---|---|---|
| C/C++ | Ghostscript | yes | yes | the interpreter; render, convert to PDF, extract text. AGPL |
| C/C++ | libspectre | yes | no | small API over Ghostscript for viewers: pages, DSC metadata, render to RGB. GPL-2.0 |
| C/C++ | cairo | no | yes | 2D graphics library with a PostScript output surface |
| C# | Ghostscript.NET | yes | yes | Ghostscript wrapper: rasterize pages, run any Ghostscript command. AGPL |
| C# | Magick.NET | yes | yes | ImageMagick for .NET; reads PS through Ghostscript, writes raster PS |
| Java | xmlgraphics-commons | DSC only | yes | Java2D to PostScript, DSC parser (no interpreter) |
| Go | canvas | no | yes | pure Go vector graphics with a PostScript renderer |
| Python | python-ghostscript | yes | yes | ctypes binding of the Ghostscript C API. GPL-3.0 |
| Python | Pillow | yes | yes | rasterizes PS through Ghostscript; PSDraw writes simple PS |
| Python | pycairo | no | yes | cairo bindings, PSSurface |
| Ruby | MiniMagick | yes | yes | ImageMagick command line from Ruby |
| Rust | cairo-rs | no | yes | gtk-rs cairo bindings, PsSurface |
| PHP | Imagick | yes | yes | ImageMagick extension; reads PS through Ghostscript |
There is no maintained pure Java, Go, Rust or .NET PostScript interpreter. Ghost4J wraps Ghostscript for Java but has had no release since 2016.
By language#
- PostScript libraries for C/C++ Open-source C/C++ libraries for PostScript: Ghostscript to render and convert, libspectre for viewers, cairo to write PS. Comparison and code examples.
- PostScript libraries for C# Open-source .NET libraries for PostScript: Ghostscript.NET to rasterize and convert PS files, Magick.NET to read and write PS through ImageMagick. Comparison.
- PostScript libraries for Java Open-source Java libraries for PostScript: Apache xmlgraphics-commons writes PS from Java2D and parses DSC comments. Code examples.
- PostScript libraries for Go Open-source Go libraries for PostScript: tdewolff/canvas writes PS and EPS from pure Go vector drawing. Code examples and notes on reading PS from Go.
- PostScript libraries for Python Open-source Python libraries for PostScript: python-ghostscript to convert and render PS, Pillow to rasterize and write PS, pycairo to draw PostScript.
- PostScript libraries for Ruby Open-source Ruby libraries for PostScript: MiniMagick renders PS pages to images and converts PS through ImageMagick and Ghostscript. Code examples.
- PostScript libraries for Rust Open-source Rust libraries for PostScript: cairo-rs writes PostScript and EPS through cairo's PsSurface. Code examples and notes on reading PS from Rust.
- PostScript libraries for PHP Open-source PHP libraries for PostScript: the Imagick extension renders PS pages to images through ImageMagick and Ghostscript. Code examples.