PostScript

Adobe PostScript (PS) is a device independent Page Description Language (PDL) released by Adobe Systems in 1984.

The Apple LaserWriter, based on a Canon printing engine, was the first device to ship with PostScript. The combination of the PostScript language, an affordable laser printing device, and PC-based design and layout programs, sparked the Desktop Publishing (DTP) industry.

Although Adobe has stopped development of the PostScript language to concentrate instead on Portable Document Format (PDF), PostScript remains an industry de facto standard language for the graphic arts, publishing, and printing industries. In fact, PostScript awareness has increased dramatically in recent times due to the marketing buzz created by Variable Data Printing (VDP).

The PostScript language has undergone two major revisions since its release in 1984.

Level 1

The PostScript language has gone through 2 major upgrades. The first version, known as PostScript Level 1, was introduced in 1984.

Level 2

PostScript Level 2 was introduced in 1991, and included several improvements: improved speed and reliability, support for in-RIP separations, image decompression (for example, JPEG images could be accessed directly by a PostScript program), support for composite fonts, and the form mechanism for caching reusable content.

Level 3

PostScript 3 came at the end of 1997, and along with many new dictionary-based versions of older operators, introduced better color handling, and new filters (which allow in-program compression/decompression, program chunking, and advanced error-handling).

Language Features

As a programming language, PostScript has many unique features. Unlike most languages, which are register-based, use variables, and have relatively few operators, PostScript is stack-based, doesn't technically use variables, and is operator rich.

All operators consume operands, and may produce results which can in turn be used as operands. All operands (and results) are placed on the stack, and all operators consume their operands directly from the stack. Thus, operaands precede their operators, in a syntax known as "Reverse Polish Notation (RPN)". For example, consider this PostScript code:

2 4 add 10 mul

First, "2'" is placed on the stack, then "4", and then the "add" operator. The "add" operator always has the same default behavior. It consumes the top two operators on the stack, adds them, and then places the result on the stack. So now we have "6" on the stack, place "10" on the stack, and the "mul" operator consumes them, leaving "60" on the stack. The "60" could then be used by other operators.

PostScript has a number of operators that perform stack manipulation to remove, duplicate, or sequence the stack in a variety of ways.

PostScript doesn't use variables per se. Instead, PostScript has a "dictionary" construct. A dictionary is a collection of key-value pairs. Most data types, such as numbers, strings, or names (a PostScript data type similar to a label or variable name) can be used as keys. Any data type (including other dictionaries) can be used as values. When a name is placed on the stack, PostScript initiates a search through all the dictionaries until it finds the key, looks up the associated value, places the value on the stack, and optionally executes it.

The dictionaries themselves are stored on their own stack, the "dictionary" stack. All versions of PostScript come with two built-in dictionaries, the "systemdict", and the "userdict". All PostScript operators are stored in the systemdict. Since dictionaries are search top-down, this makes it possible to do operators re-definition. If a programmer needed to change the behavior of any PostScript operator, this could be accomplished by creating a procedure, assigning it the same name as the operator, and storing it in a higher-level dictionary.

All text and images are licensed under a Creative Commons License
permitting sharing and adaptation with attribution.

PrintWiki – the Free Encyclopedia of Print