Sunday, December 18, 2011

What Is Postscript? What Does It Have to Do With My Printer?


5816394047_aa920d5992_b
When printing, you might have come across the word “Postscript.” Ever wondered what the heck this means, and relevance it has to your printer? Take a minute, learn some computer history, and a little bit more about desktop printers work.
Unless you’re a computer scientist, it can be confusing to look up “Postscript” and learn that it’s a “concatenative programming language” only to find you have even more confusing words to look up. Today, we’ll make it easy, and put Postscript into context, explain what it is, why and how it does what it does, and how it pretty much turned the whole graphics world on its collective ear! Keep reading, there’s some good geeky fun stuff ahead.

ASCII, Dot Matrix, Plotters, and Changing Printed Graphics


Before we understand Postscript and more modern printing devices, we have to consider the humble roots of PC to print technology. Early computer printers were crude devices made only to reproduce text and ASCII characters—there was little to no application of graphics, and little to no use for them. These so called “dumb” printers could be programmed to produce text, although many would have had hardware limitations that would stop them from printing anything but the characters in the hardware—think “typewriter.”

Some of us at How-To Geek might date ourselves and say we remember an important next step in printer evolution—dot matrix printers. These were capable of printing some crude grayscale graphics with rows of pixels, as well as blocky, low pixel depth typography. Although they did have the advantage of creating digital images (although ASCII art sort of counts), the crude typography was a setback for early dot matrix printers. All dot matrix printers took directions on printing images and text in roughly the same way; break it into pixels, printing them in rows as the print head passes along the paper, feed the next bit of paper, and repeat.
Unlike dot matrix printers, plotters are still fairly common, particularly in manufacturing. Plotters move papers, vinyl, or various other materials around on algebraic coordinates to draw, print, or cut smooth, mathematically pure vector shapes with a stylus or knife blade. As we’ve learned, because of the nature of typographic glyphs, vector shapes are vastly superior to pixels for defining abstract, mathematically pure shapes found in type. Because plotters are engineered to move around based on precise math, the instructions on how to create typography and other shapes are fairly easy for a PC to communicate to the device.
The challenge was this: no existing model of PC to print technology could create vector-based, clean typography AND graphics at the same time. What were all the clever geeks supposed to do?

Xerox PARC, and Development Of The First Laser Printer


Xerography, AKA photocopying, was the development printers were looking for. Although Xerography had been invented in the thirties and made commercially available as copy machines in the late fifties and sixties, it wasn’t used in PC printing until Xerox PARC engineer Gary Starkweather designed the first laser printer.

Here’s a graphic and a rough descriptions of how Xerography works: light hits electrically charged areas of the printing drum, the electrons react and those negatively charged areas lose that charge. Toner adheres to the static electricity, and is pressed onto the paper, creating artwork without the use of dot matrix style pixels. And because this printing process was fundamentally different from any of the comparatively crude methods listed above, Xerography was a logical way to print clean type and graphics at the same time. There was one simple engineering problem that had to be solved—how do you create instructions for a printer that can easily do both at once?

The Best of Both Worlds: Postscript is the Print Whisperer


Enter Adobe engineers and co-founders John Warnock and Charles Geschke. The pair had worked together at Xerox and had created page description language (or PDL) called Interpress. Interpress solved this engineering problem—it was a system of translating images and complicated shapes into data the printer can use to turn out high quality printed artwork. Interpress was not necessarily the first PDL, and it wasn’t Warnock and Geschke’s last collaboration. Leaving Xerox PARC, the pair developed a flagship product in Postscript, which has remained, even to this day, a graphics industry standard.
Postscript, as the name sort of suggests, is actually a Turing-complete programming language. Directions are written out in a human-readable way, and communicated to the printer, which creates the high quality art from the instructions. Here’s a sample “Hello World” program from Inkguides.com.
%!PS
/inch {72 mul} def
/Times-Roman findfont 50 scalefont setfont
2.5 inch 5 inch moveto
(Hello, World!) show
showpage
We start to see pretty quickly what kind of instructions Postscript is giving the printer, and just how simple the directions are. Fonts referenced in this program exist in vector form and are called up from separate files—and were a big part of Adobe’s contribution to the digital graphics industry. Here’s a second example, from Mikkel Meinike Nielsen’s page on Postscript:
%!
/Times-Roman findfont 16 scalefont setfont
gsave                   %save before using translate
105 210 translate %This cordinates places the images on
%the page
%————-The actual image begin———————
76.8 86.4 scale
40 45 1 [ 40 0 0 -45 0 45 ]
{ <
fffff5ffffffffdeffffffffeaffffffffdeffffffffffffffffffeeffff
fffffefffffffffbffffffffffffffffffccffffffff77bffffffeffdfff
fffdfff7fffffbfff7fffff77ffbffff5ebfbdfffafdbf7ebffbf3ff6fdf
e9ef7ff7f3d6bfff7d55afff7efffafffffffffcffff7efffffffef7ffff
fffdf77fffffffeffffffffdf7bffffffbd7bfffffffbffffffff7fbbfff
ffef7bffffffeefbdfffffdef7bfffffffffbfffffbdefffffff7dff7fff
ff7bdffffffff7ff7ffff977e57ffffa5ffbffffff7feebffffdbff4bfff
ff7fffffffffffffffffffffffffff> } image
%————-The actual image end ———————
grestore %restore the settings from before the translat
0 245 moveto (Text and image, ) show
0 229 moveto (side by side. ) show
showpage
This large middle section of gobbledygook is actually hexadecimal code that defines an image. Most Postscript isn’t written by hand like this, but rather by programs. To get an idea of what this Postscript code actually looks like, take a look at this screencap from Mikkel’s page below of the image this code generated. Entire photographic mages can also be re-written as postscript this way—the filetype is called Encapsulated Post Script, or EPS.

Modern Printed Pages and Newer Printing Processes


Nowadays, not all printers use Postscript, but all of them have to have some kind of translation layer to turn text and image data into printed material. We usually call these programs printer drivers—and nowadays they come from the manufacturer, and are a proprietary software. In some form or fashion, this Is an crucial piece of what all printers need to communicate with PCs—even though the printers we use in our homes are solving very different problems than the first laser printers. Regardless, Postscript was Adobe’s first big success, and is part of what effectively the start of a worldwide popular explosion of graphics and design.

No comments:

Post a Comment