PostScript is primarily a page description language, which is used to describe the graphic elements and text on a page or other type of document. The language is, however, versatile enough to label it as an actual high-level programming language.
- Like other computer languages, PostScript supports different types of data, such as numbers, arrays, and strings. A PostScript program can have loops, conditionals, and procedures. The language resembles the programming language Forth somewhat.
- The syntax of the language is described in the so-called Red Book which can be found here. As with all computer languages, the slightest deviation from the well-defined conventions of the language results in an error message and a computer system that refuses to do anything at all. If you print a job to a PostScript device and a network glitch causes the ‘showpage’ command to arrive as ‘shopage’ at the output device, the system will happily generate an ‘undefined’ error message and refuse to print your job, even though it has already processed your entire page and the ‘showpage’ command is simply there to tell the output device that it can start outputting your masterpiece. In the past, such errors would occur regularly – hence the long list of PostScript error messages that can be found on this site.
- Just like some HP calculators, the PostScript language uses reverse Polish notation (RPN).
- Since PostScript is virtually always used to describe where something is located on a page, it has a coordinate system. By default, the lower left corner of the page is considered to be its starting point. Distances or measurements are usually expressed in points. There are 72 points in an inch. 1 point measures 0.352 mm.
Here is a Computerphile video about programming in PostScript:
Sample PostScript code
PostScript is a high-end programming language, which means that even mere humans can still look at the instructions and understand what they mean. If you open a PostScript program with a word processor or editor, it may look like this:
%%BeginProlog %%BeginResource: procset AdobePS_Win_Feature_Safe 4.2 0 userdict begin/lucas 21690 def /featurebegin{countdictstack lucas[}bind def /featurecleanup {stopped {cleartomark dup lucas eq{pop exit}if}loop countdictstack exch sub dup 0 gt{{end}repeat}{pop}ifelse}bind def end %%EndResource
It can take a while to understand what the above gibberish means, but you can learn to make sense of it. Of course, this will take years and by the time you are that proficient in programming, your youth will have passed, your computer screen will be more important to you than anything else in the world and the opposite sex will remain a complete mystery to you for the rest of your life (although I am willing to admit that I don’t know how to program and can’t make much sense of women either.)
Laurens, PostScript being replaced by PDF is like saying we are going to replace rodas with cars.
Postscript is a procedural interpreted language, while PDF is a file format. I fail to see, how you got these 2 in the same bag…
(although I am willing to admit that I don’t know how to program and can’t make much sense of women either.)
lol nobody does
please easy to understand details
I don’t exactly understand what you mean. If you’re asking me to expand this page and add a lot more detail: that is not on my agenda. PostScript is on the way out and gradually getting replaced by PDF. There is no point, for me at least, in spending any more time on it.