4]----------------------------- 3]Laser Printers and Postscript 3]By Tom Krotchko 4]----------------------------- High on the wish list of any computer owner is a laser printer. A laser printer can do all types of printing jobs quickly and with excellent print quality. The down side is comprised of the high initial cost, replacement costs for toner cartridges, and the complexity of using the printer to its fullest potential. You will learn a whole new jargon of toners, fonts, paper weights and graphics languages. In some ways it's as complicated learning the terminology of a new computer. For an Amiga owner, the situation is worse than IBM PC and Macintosh owners since a laser printer is an uncommon peripheral for an Amiga, and most software doesn't support these printers to their fullest ability. Armed with just a little knowledge, however, using a laser printer with the Amiga can be as rewarding as with any other computer. 3]LASER PRINTERS: NOT FOR STAR WARS When I first heard of laser printers, I imagined a powerful laser carefully searing the paper with a red-hot beam of light. Actually, the mechanics of a laser printer are not quite so dramatic, although still interesting. There really is a laser in a laser printer. However, it is used to place a static charge on a drum inside the printer. The static charge is usually made in the shape of letters and pictures. As the drum rotates, toner (a fine black powder) sticks to the places on the drum where the static charge was placed. The drum with toner is pressed against paper. The toner adheres to the paper, and is made permanent by contact with another hot drum. Despite the rather ordinary use of a laser in the printer, it's a fairly complex device. It requires its own internal computer. The widely used Hewlett-Packard LaserJet II series of printers has a Motorola 68000 chip controlling the printer. This is the same CPU as used in the Amiga 500 and 2000 computers. The main difference between a laser printer and most other types of printers is a laser printer prints a page at a time instead of a line at a time. A dot-matrix printer will translate ASCII codes into letters and print each letter individually, with the occasional change in print style represented by an escape code. A laser printer, on the other hand, receives information about the entire page, and places text and lines according to information received about that page. The page is printed only when the printer receives enough information to complete the entire page. 3]RESOLUTIONS Resolution of printers is measured in Dots Per Inch, or DPI for short. The crudest resolution of most laser printers is 75 DPI. This represents 5625 dots per square inch. The best resolution of most laser printers is 300 DPI or 90000 dots per square inch. Since the printer must define the entire page before printing, it must contain enough memory to hold an entire page's worth of data. It's a black and white printer, so each dot can be represented in the printer's memory by a single bit (0=white and 1=black). Lets assume an average page size of 8.5" x 11". At a resolution of 75 DPI. This would take (75 DPI x 8.5 horizontal width in inches) x (75 DPI x 11 vertical width in inches) = 525938 bits. A byte has 8 bits, therefore, the memory required by the printer for this resolution is roughly 65K bytes. To print the identical page at 300 DPI, the memory requirements of the printer would be (300 DPI x 8.5) x (300 DPI x 11) = 8,415,000 bits or 1 megabyte of memory. So, it is important when buying a laser printer to have at least 1 megabyte of memory, or it will be impossible to print an entire page worth of graphics at the best resolution of the printer. Most such printers will only come with 512K, so the base price is somewhat deceptive. This memory must be in the printer. You cannot use the memory from your computer for this purpose. On the other hand, when printing plain text from a laser printer, the 512K is more than enough. That's because the standard typefaces are contained in the ROM of the printer. The memory of the laser printer need only keep track of where the letters are located on the page, not the actual shape of each letter. In this case, a page might take up only few hundred bytes in the printer's memory. Don't decide the default font in the printer is "good enough". If you do, you'll be missing the best part of a laser printer, and probably wasting your money. A laser printer is capable of so much more than the standard, ugly Courier font. You may be surprised when you see how much the printer can do. 3]COMPETING STANDARDS A laser printer is complex enough to use its own special language to control different features of the printer. A simple laser printer language will have commands to change fonts, select printer resolution, control the number of copies, etc. A complex laser might contain commands to make fonts bigger or smaller, draw complex shapes, rotate shapes etc. Two languages seem to be the two major standards in the laser printer industry: HP PCL and Postscript. HP PCL stands for Hewlett-Packard Printer Control Language. It is an example of a simple control language. It has a few, simple commands that are only slightly more complex than the escape codes used by a dot-matrix printer. The PCL manual for HP printers describes about 98 commands. They range from describing the size of the page to defining the default font for the printer. A command consists of a few characters, and always begins with the character (ASCII 027). Here's a few examples of the PCL language: &l66P - sets the page length to 66 lines &l1O - selects landscape mode *t300R - resolution set to 300 DPI This language isn't particularly user-friendly and isn't usually written as a program. The commands are used mostly by applications to set up the laser printer before printing. HP PCL is a widely copied language and almost every laser printer can understand these commands. The two notable exceptions are Canon laser printers (for legal reasons) and Apple Laserwriter printers. Postscript by Adobe is another popular printer language. However, Postscript is more than a printer control language like HP PCL. Invented in the 1980's, it is a page definition language. One of its biggest strengths is that it allows a page to be defined without regard to the physical characteristics of a printer. In other words, a page may be defined in terms of text and drawings. A A Postscript printer will print the page definition to the best of its ability. So a A 300 DPI Postscript laser printer could be used as a proofing device before being sent to a Postscript printing press. Postscript cannot make a printer "better" than it would otherwise be. Postscript is closest to the language Forth. It makes heavy use of a concept known as the "stack". An example of Postscript from the Adobe Postscript Cookbook (Addison-Wesley): %--- This code segment will draw a square. --- /centersquare { newpath .5 .5 moveto -.5 .5 lineto -.5 -.5 lineto .5 -.5 lineto closepath } def Postscript has a set of 14 variable types including integer, real, boolean, string, and arrays. It has at least as many commands as Basic, though the commands are understandably geared towards graphics and text. Like Basic, it is an interpreted language. 3]BACK TO PCL Although HP PCL lacks the richness and complexity of Postscript it is popular for two reasons. First, it is inexpensive. As noted before, almost every laser printer will emulate HP PCL. It supports different font types, but lacks the ability to scale fonts. Scaling Fonts is the ability to take a font definition and make it bigger or smaller. PCL printers can store font definitions, but cannot make the fonts bigger or smaller than the original font definition. The HP LaserJet III does have the ability to scale fonts, but the fonts must be a unique type, and this ability is not available outside of the HP LJ III at this time. The second reason HP PCL is popular is Hewlett-Packard has pioneered desktop laser printers and has probably sold more laser printers than anyone else. You might expect HP PCL to receive major support from software manufacturers, but outside of the IBM PC compatible world, there is little backing for this standard. For the Amiga, only two programs I now of support HP PCL: City Desk and Wordperfect. Perhaps the inability of HP PCL to scale fonts makes this standard so unattractive for many applications. If the printer can't scale fonts, it means the computer must keep a definition of each font size on its hard disk. For a minimal set of fonts, this could easily be 10 megabytes of hard disk storage. For involved desk top publishing applications, 100 megabytes of fonts could be required. On the other hand, HP PCL output is neither better nor worse than corresponding Postscript output. Remember, Postscript doesn't make things better, just easier. 3]POSTSCRIPT If you are interested in learning to program Postscript, a couple of things are essential. If you own a Postscript capable printer, you already own the most expensive requirement. If not, the ingenuity of the Amiga community has come to the rescue. The program POST (v1.2), is a freely distributable program by Adrian Aylward that is a Postscript interpreter. POST allows you to either view the results on screen, or print to a non- Postscript printer. Although Mr. Aylward has made Post freely distributable, it requires you to use the arp.library (again, freely distributable), and Conman, which is shareware. In addition, the minimum memory requirement is 1 megabyte with 2 megabytes preferable. Even at the shareware cost of Conman, this program is a bargain. Similar commercial programs for MS-DOS exist, but cost several hundred dollars. This program will allow you to learn a great deal about Postscript at low cost. A second requirement to learning Postscript is the "Postscript Language Tutorial and Cookbook" by Adobe Systems, Inc, and published by Addison- Wesley. This is often referred to as the "Blue Book". It will get you started with its many good examples and is a relative bargain at $16.95. 3]A SHORT DESCRIPTION OF POSTSCRIPT Adobe explains Postscript as both a Page Definition Language (PDL) and an Imaging Model. As a PDL, it combines the ability to define text in various typefaces with the ability to place the text in any position, orientation, and scale. In other words, you can scale text and rotate it. Geometric figures can be defined and may also be scaled and rotated. Postscript also has the ability to include digitized pictures. An Imaging Model is a bit harder to explain. It involves three fundamental concepts of Postscript (1) Current Page (2) Current Path and (3) Clipping Path. Current Page is an imaginary page that exists only in the mind of the programmer and the memory of the computer. Postscript commands will place marks on this imaginary page. Current Path is a set of points, lines, and objects that are described but not drawn. This may be a little hard to imagine, but the easiest way to think of the Current Path is an artist describing what he is about to draw. The current path will get marked on the current page when it is "stroked" onto the Current Page. Clipping Path is the boundary of the Current Page. Generally, the Clipping Path will be the physical size of the page in the printer, but this is not a requirement of Postscript. 3]PROGRAMMING CONCEPTS Here are a few basic concepts of Postscript as a Programming language: (1) Postscript stack - Postscript makes use of a "last in, first out" stack. This can be thought of as a stack of papers. The last paper placed on a stack is the first paper that must be taken from the stack. Things are implicitly pushed on the stack. To remove something from the stack, the command "pop" is used. (2) Postfix notation - If you own an HP calculator you should be familiar with this concept, sometimes called "Reverse Polish Notation". The command to add two numbers in Postscript is: 10 20 add The number 10 is pushed on the stack, then the number 20. The operator "add" (pops) the top two numbers on the stack (20 and 10) and sums them. The sum is pushed on the stack. (3) Postscript Data Types - Postscript defines all the standard data types found in other languages. In addition, several data types are supported, specifically to support page definitions. Postscript programs may define their own procedures if one does not exist in the language. The defined procedure may involve other previously defined procedures, so the language is largely self-defining. 3]AN EXAMPLE Rather than go through an extensive Postscript tutorial, I'll just present a simple program that should work with the POST Postscript interpreter. The program is the program presented on page 58 of the Adobe Postscript Language and Tutorial mentioned earlier with changes made so its a little more topical. Comments are marked with the percent sign, %. %------ define the font to be used by the program -------- /CenturyBI findfont 27 scalefont setfont % Retrieve a font and set the size %------ define procedures: fourpops, background, moon, jumpdisk ----------- /fourpops % procedure to pop the stack four times { 4 {pop} repeat } def /background % procedure to define rectangular { 0 18 moveto % background with rounded corners 0 72 200 72 18 arcto fourpops 200 72 200 0 18 arcto fourpops 200 0 0 0 18 arcto fourpops 0 0 0 72 18 arcto fourpops fill } def /moon { .6 setgray % sets the color gray to use 181 45 18 0 360 arc fill % draw a circle and fill it } def /jumpdisk { 1 setgray % sets the color to white 0 -1 moveto 1 2 scale (JUMPDISK) stringwidth pop % These next few lines get the 200 exch sub 2 div % width of JUMPDISK, and center 0 rmoveto % it within the background (JUMPDISK) show} def %------------------ beginning of main program ------------------- 255 465 translate background % draw the background moon % draw a circle jumpdisk % superimpose JUMPDISK showpage % nothing is actually drawn until this % command is executed %--------------- end of Postscript Program ----------------------- Although it may look a little odd, the program itself is fairly understandable to anyone who has programmed in any language. 3]ODDS AND ENDS TO FINISH UP Postscript is such a good idea, its a wonder someone didn't think of it sooner. Defining page layouts without regard to the ultimate printing device makes the language usable on any computer or printing device. The entire printing industry is now centering on Postscript as its imaging model, with Postscript Linotype (printing presses) becoming increasingly popular. The down side to Postscript is its cost. Postscript printers tend to be expensive, and prices of several thousand dollars are not uncommon. It is possible to add Postscript to most HP PCL compatible printers, though it usually costs from $500 to $1000 to add. Not only is some sort of Postscript cartridge required, but the printer will require at least 2 megabytes of memory. For the HP Laserjet, HP makes an "official" Adobe Postscript cartridge, as does Adobe. Other third-party cartridges are becoming increasingly common, with the most popular being the Pacific Page cartridge from Pacific Data. This cartridge isn't "official" Postscript, but is a Postscript clone called PhoenixPage, by Phoenix. Postscript is also very slow. Since it is a language that requires interpretation to print, the CPU in the printer is used heavily in the Postscript process. Something that may not seem obvious is that you can't just type a file to the printer for quick printing. A Postscript printer interprets everything sent to it as Postscript commands and will become very confused if you send a text file to it directly. You must use either a Postscript capable word processor or some text printing utility to do simple prints. In its own way, Postscript makes everything more complex. Finally, Postscript won't allow a laser printer to do anything it wouldn't be able otherwise do. A 300 DPI Laserjet will still look the same regardless of the language used to define the page. 3]THE SUM UP Laser printers are perhaps the most complex and versatile peripherals you can connect to a computer. Regardless of the way you use your printer, its capable of much more than simple printing with standard fonts. Even if you can't afford to explore the ins and out of Postscript, there are options to make better use of the native HP PCL abilities of the printer. Some books worth owning: The LaserJet Handbook $25.00 Postscript Language $17.00 by Steven J. Bennett Tutorial & Cookbook and Peter G. Randall by Adobe Systems, Inc. Simon & Schuster, Inc. Addison-Wesley Publishing Copyright 1988 Copyright 1985 Learning Postscript: A Visual Approach $23.00 by Ross Smith Peachpit Press Copyright 1990 4]END OF TEXT