Version 9 of Postscript

Updated 2002-06-16 22:47:14

<B style="color:black;background-color:#A0FFFF">Postscript</B> is a programming language (in reverse polish notation, see RPN in Tcl) that is used mostly for representing printable documents. More decent printers usually understand (interpret) <B style="color:black;background-color:#A0FFFF">Postscript</B> right away.

Popular tools to visualize <B style="color:black;background-color:#A0FFFF">Postscript </B><B style="color:black;background-color:#99ff99">files</B> are ghostscript/ghostview [L1 ].

The <B style="color:black;background-color:#A0FFFF">Postscript</B> Language Reference Manual and some related specifications can be found at [L2 ].

Syntax in brief: Words are separated by whitespace, but the ten special characters %/(){}[]<> also end the previous word (with some exceptions). % starts a comment, that continues to the end of the line. / before a word makes that word literal (prevents that it is executed). Parentheses delimit strings; \ is escape character in strings. Braces delimit procedures (executable arrays); they work sort of like in Tcl. Brackets construct normal arrays, which are similar to lists in Tcl, except that they have fixed length :-(. The PS code

 a [b /c /d e] f

is sort of equivalent to Tcl

 $a [list $b c d $e] $f

or (if f is more of a command than a variable)

 f $a [list $b c d $e]

A typical <B style="color:black;background-color:#A0FFFF">Postscript</B> file starts with a %! comment, and it usually contains a couple of %% comments that contain markup for programs that manipulate <B style="color:black;background-color:#A0FFFF">Postscript </B><B style="color:black;background-color:#99ff99">files</B>.

 %!
 %%Creator: Gif2PS
 /#copies 1 def

The last line is an assignment: "assign to the variable #copies the value 1", or set #copies 1 as we would say in Tcl.

See also Manipulating <B style="color:black;background-color:#A0FFFF">Postscript</B>