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:

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.

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.

Reference

  • 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.

Tools

  • 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

An essential tool for working with PostScript is GhostScript (or the Free Software Foundation's GNU Ghostscript ).

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

GhostScript Tools

  • 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.

Postscript Today

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:

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.