Learn PostScript Programming
PostScript is a special purpose programming language designed for describing visual output: printing, page layout, font design, desktop GUI, and individual images. The descriptive aspect of the language is able to define images in a resolution-agnostic manner — this means that it doesn't describe pixels (like a bitmap) but rather describes shapes which can scale to any size or resolution, somewhat similar to the simpler Scalable Vector Graphic (SVG) format.
What makes PostScript really interesting, though, is that it isn't just a visual description language. It is also a Turing-complete, high-level programming language. This means that you can do more than simply describe a scalable image; you can also define algorithms that create images, or write complex programs that generate meaningful visual output, or extend it to build a desktop GUI system.
PostScript is a powerful and interesting language with a wide array of uses, from desktop publishing to data visualization.
A Brief History of PostScript
While working on integrated circuit design and nascent laser printer technology at Xerox in the late 1970s, John Warnock, Charles Geschke, and several others invented a language called Interpress. Interpress was a page description language, which means it could be used to describe the visual layout of elements on a printed page. It was based on Forth and was inspired by — among other things — Warnock's previous work on a 3D graphics interpreter.
Warnock and Geschke attempted to persuade Xerox to directly commercialize the language, but Xerox was ultimately uninterested. The two of them, along with Doug Brotz, Ed Taft and Bill Paxton, left Xerox and founded Adobe Systems. Adobe was founded in 1982. PostScript, inspired by Interpress, was released in 1984.
Steve Jobs, founder of Apple, influenced Adobe to make PostScript suitable for driving laser printers. In 1985, Apple released the first laser printer with PostScript support. This launched a desktop publishing revolution, with Apple and Adobe at the center. The persistent dominance of Adobe software (Photoshop, Illustrator, Acrobat) and Mac computers (even though Apple doesn't make printers anymore) in professional graphics and publishing work — and related creative professions — is largely due to the course set by their early cooperation over PostScript.
A second version of PostScript, dubbed "PostScript Level 2" was released in 1991; the original release was retronymed to "PostScript Level 1." When the third and finale release came in 1997, it was simply called "PostScript 3."
The Decline of PostScript
PostScript can, and has been, used in a wide variety of ways. For example, two different desktop GUI systems were based on PostScript, and it was used as the basis for a graphics file format. However, the three major areas of use were as a printer control language, as a page-description language for creating document layouts, and as a font format.
For the majority of users — especially in desktop publishing — each of those three main areas of use have been largely superceded by later technology:
- Adobe introduced the Portable Document Format in 1993, and made it an open standard in 2008. In 2007, Adobe Principal Scientist Dov Isaacs made clear that PostScript was essentially deprecated in favor of PDF for page description language, and further that the EPS graphics file format should no longer be used for new artwork.
- PostScript Font formats were first challenged by Apple's TrueType format and then eventually superceded altogether when Adobe and Microsoft partnered to create the OpenType specification. OpenType is a superset of both TrueType and PostScript, so — in a way — PostScript lives on in OpenType, but not as a standalone language.
- PostScript's use as a printer control language has largely been outmoded by HP's Printer Command Language (PCL), which has become the industry standard.
Basic PostScript Tutorials
PostScript is more often generated programatically than it is written by hand. So, many people using the language only need to have a basic understanding of it, not an in-depth fluency. If you just need to understand what a PostScript file is and how they work, read through one or two of these and you'll be off to a great start.
- Brief Postscript Tutorial, a short, but helpful, introduction to the language from computer science classes at Carnegie Mellon University.
- How to Do Simple PostScript Commands, a quick introduction to simple drawing commands.
- A Tutorial Introduction to PostScript, a tutorial on using the language, which also includes quite a bit of useful background and history.
- Tom Trebisky of the Multiple Mirror Telescope Observatory has a somewhat irreverent PostScript Tutorial, which will be especially helpful if you like reasonable explanations for PostScript's weirdnesses. ("One day long ago, the PostScript authors were sitting around smoking crack.")
- A Short Introduction to PostScript (PDF), one of the better introductory tutorials, with well-labelled examples and clear explanations — great for visual learners and also those with some basic coding experience.
- Math-Centric PostScript Manual, from the Mathematics Department of the University of British Columbia.
- Adobe's PostScript Language, and Why "Direct" PostScript Makes Sense, an introduction to the language, with a compelling argument for learning to write PostScript directly, rather than generating with graphics editing software.
- PostScript Tutorial, an example-rich introduction from UC San Diego (also available as a PDF).
- Mostly Maths' Quick PostScript Tutorial, where you can learn to make a Christmas card decorated with fractal snowflakes; and if you like that, check out L-Systems in PostScript, where you can learn to make dragon curves and other beautiful recursive designs.
- PostScript Video Tutorial in Three Parts: 01 Stack, 02 Arithmetic, 03 Graphics.
- Programming in PostScript Video Tutorial, a talk specifically about PostScript as a programming language, and not just a graphical description language.
In-depth Resources for Learning PostScript
These tutorials provide more complete coverage on the language, from basic use to advanced concepts. Most of them will require an extended amount of time to work through.
- A First Guide to PostScript, a nice step-by-step introduction to PostScript.
- Learning PostScript by Doing (PDF), which is the only way to learn, really.
- Thinking in PostScript (PDF), an essential guide to really understanding the language.
- Mathematical Illustrations: a Manual of Geometry and PostScript, Bill Casselman's indispensable guide to using PostScript for mathematics and visualization.
- PostScript Language Tutorial and Cookbook (PDF), the official language guide from Adobe Systems — known as the "Blue Book".
- PostScript Language Program Design (PDF), another official Adobe reference work — known as the "Green Book."
- PostScript Language Reference (PDF), a highly technical 900-page manual from Adobe, covering every detail of the language.
- PostScript FAQ, a WikiBooks resource.
- Don Lancaster's Guru's Lair PostScript Library, a remarkable trove of information on PostScript and related topics, plus software tools, geometry tutorials, and a bunch of other things you'll probably need if you get serious with PostScript development.
- Acumen Journal, a (now-defunct) periodical covering PostScript and PDF news and information — archives from 2000 to 2013 are available online and contain a wealth of information.
- PostScript Examples, a list of links to example sets including those from the blue and green books.
- ImageMagick, a software suite for creating, editing, composing, or converting image files into and out of a number of formats, including PostScript.
- Pslib, a programming library for dynamically generating PostScript files; writtern in C, with bindings for PHP, Python, Tcl, Perl, COBOL, and Common Lisp.
- Gnuplot, a command-line graphics and data visualization tool, which can output PostScript (and many other formats).
- Cairo, a graphics library in the C programming language, which supports PostScript output; also see the ADG library, which provides CAD-like drawing objects.
- GNU a2ps, an "any to PostScript" conversion and printing utility.
- GNU Enscript converts ASCII files to PostScript.
GhostScript is a PostScript interpreter and PDF viewer and editor, which can be used for converting between those two and several other file formats, as well as for creating PostScript files from scratch. It is also often used "under the hood" by printer drivers, when printing PostScript output to non-PostScript printers. You can use GhostScript to create virtual PostScript printers, or to print directly to PDF.
Alternatives to GhostScript
GhostScript is a large program with a lot of overhead. For simple viewing of PS files, there are also two related "PostScript preview" apps, GhostView and GSView.
For PostScript files, there are a handful of freeware PostScript viewers, but — since GhostView is free and open source — there isn't a compelling reason to use them. There is an online PostScript viewer, which might be helpful if you just need to look at something from time to time and don't want to take the trouble to install GhostView.
Adobe's Acrobat allows users to work with both PDF and PostScript files, and is the "gold standard" of commercial products in this space.
Resources for Learning GhostScript
- Introduction to Ghostscript, a very quick overview from the University of Wisconsin Computer Science Department.
- Another Introduction to GhostScript, this one with a bit more detail.
- Introduction to GNU GhostScript explains basic GhostScript use, and includes a basic PostScript tutorial as well.
- How to Use Ghostscript, the in-depth official documentation.
- GhostScript User Manual (PDF), a guide to getting GhostScript up and running, excerpted from PostScript & Acrobat/PDF: Applications, Troubleshooting, and Cross-Platform Publishing by Thomas Merz.
- Getting Started With PostScript, is a GhostScript-focused introduction to using PostScript.
- Using Ghostscript to Convert and Combine Files, a quick guide to one of the more common tasks in GhostScript.
- Ghostscript Linux Howto, this is a good overview of using GhostScript in a Linux environment.
- Creating PDF/A output using XeTeX and Ghostscript, is a tutorial for creating PDF/A files, required by some publishers.
- Ghostscript — First 10 Steps explains how to get GhostScript up and running in Windows 10.
- Creating a Virtual PostScript Printer in Windows using Ghostscript explains how to use your existing non-PostScript printer as if it were a PostScript printer, using GhostScript; the tutorial is geared for Windows XP users, but the technique can be adapted for other Windows systems.
- Print to PDF with Ghostscript and RedMon on Windows explains how to use GhostScript to create high-quality PDFs without relying on Adobe's expensive software; this tutorial covers the same topic, but includes information on earlier Windows versions.
- Ruby-ghostscript is a Ruby wrapper for GhostScript, making it wasy to include a GhostScript binary in your Ruby and Ruby on Rails apps.
- Ghostscript.NET is a managed wrapper around the Ghostscript library, for use with the .NET framework.
There are still a handful of developers actively using the language, but the demand for PostScript developers has plummeted. Today, the most likely place to find serious PostScript use is in legacy systems at high-end publishing companies. A number of desktop tools, including LaTeX and GhostScript continue to be developed and used for PostScript preparation primarily as part of a document production chain connected to these legacy publishing systems.
Further Reading and Resources
We have more guides, tutorials, and infographics related to typesetting and publishing:
- TeX and LaTeX Introduction and Resources: this typesetting system makes great use of GhostScript.
- ImageMagick Introduction and Resources: a collection of graphics tools, which include some for PostScript.
Web Design Trends You'll Never Forget
PostScript allows you to design anything you can think of. That is not always the best thing; just think of the web! In our infographic Web Design Trends You'll Never Forget we run through decades of designs that were once thought to be the height of coolness.