Laser Printer Codes

Printers > Laser > Languages

Click for Site HomepageNavigation Icons Guide
Printers - Main Index PagePrinters Index
Laser Printer Topic - Overview & IndexLaser Printer Topic Index 
Introductory Text on Laser Printing  & ElectrophotographyLaser Printer Intro Text


ASCII Codes and Emulations

 
 
Most computer printers still include a rather basic method of communication that dates back to the early years of the 20th Century and the invention of the teletype.  This rudimentary method of communicating a character  at a time is not only still present but elaborations on it formed the basis of many of what are now known as print languages.

Using an ancient telegraph code in modern computers might seem idiosynchratic to say the least but it is actually a very efficient way to move plain text. It can be extended using escape codes to provide more decorative text with fonts.

Printer makers had a mountain to climb if they wanted to do anything else. An A4 page looks simple enough but interpreted as pixels for graphical use it's around a megabyte for the simplest page image. Early PCs had maybe 128 kilobytes of memory so printers with over a megabyte of memory wouldn't be affordable. Furthermore communicating that volume of information would take ages - many early printers had RS232 serial connections working at just under 10,000 bits per second.

These days with gigabit chips costing a dollar or so a lot of low cost printers are "Host Based". Host based PCs expect the page image to be made up in the users PC and communicated at 400 million bits per second over Hi-speed USB. However there are problems with this approach as well: it slows the users computer down and it doesn't suit networks because it makes huge bursts of traffic.

What we have at the moment are two common languages, PCL and PostScript, at least half a dozen other survivors like Esc/P and some contenders for new standards.

Teletypes & ASCII

Early computer printers were often teleprinter mechanisms. The teleprinter was mainly built for telegraphy, passing short text messages.  When a key is pressed a teleprinters sends a start bit, then fixed code of on/off signals and then a stop bit. At the other end of the line the start code releases a clutch, further actions as the mechanism turned pulled a typeface into position and finally a hammer struck the typeface against a ribbon to print the character. There were 5 bit "Baudot" and 7 bit ASCII codes amongst others.

Teleprinters were often used as computer printers into the 1980s. The computer sent a code representing the character to be printed and the printer carried out the action. English text has 26 upper and lower case characters, 10 decimal digits and a wide range of punctuation marks only a few of which are common. English text can be represented with fewer that 100 codes so a the 5 bit code basically sent upper case letters and had an escape for numbers . The 7 bit code had upper and lower caser numbers and punctuation that didn't need escape codes - but an escape code was provided in case it turned out useful.


The 7-bit character code originating with teletypes and still widely used by computers is known as ASCII (American Standard Code for Information Interchange). A printer using ASCII code receives a charachter, prints it, then positions for the next character. The machine can only work  left to right across the page, from top to bottom. There are special non-print characters for new-line, new page and to control the communication process itself.
On the teletype there are no characters for any kind of graphics and even underline is difficult requiring the machine to print a character, backspace, then print the underscore.

Teletypes, daisy-wheel printers and band printers hold the shape of the character as a mirror-image raised pattern on their print mechanisms. When the printer gets a code it selects the character then presses it onto the paper through a ribbon leaving an image the ight way round. These impact printers can only manage the font they are given unless the user changes the print element. One of the advantages with the daisywheel printers popular in the 1980s was the ease with which the user could change wheels and select a new font.

Unitl the early 1980s printers were basically dumb devices; send a character it prints a character. Send carriage return and the carriage quite literally moves back to the beginning of the line.

With this kind of printer the work of making up the page belongs to the computer, but the effort is not that great.

A standard A4 page of printing has 66 lines 80 characters long – so at most it contains 5,280 characters. The teleprinter page was typically a bit narrower and shorter because the machines were often made in the USA . Transferring this volume of data took typical teleprinters quite a long time, they managed about 10 characters per second so a densely printed page might take about 8 minutes to print. A page of text  is less demanding for any of the dot matrix hardware made after 1970, they typically manage a line per second so they were a big improvement on the teleprinter in terms of speed. Teletype actually made one of the early dot-matrix machines, the KSR43 which was a typewriter sized device with a particularly nice keyboard - unfortunately for Teletype it was a 7 pin device presumably because their main market was only interested in messaging. A nicer printer might have had market appeal and made them a player in microcomputers.

A basic page is just a few thousand characters as ASCII code.
The efficiency of character codes combined with some irreversibility of investement is one reason why the basis of printer communication is still an ancient code invented for telegraphy. 

Dot Matrix, Block Graphics & Fonts


Dot matrix printers could completely change things. The printer covers the paper with a pattern of dots. The dots could make any pattern, not just text. When dot-matrix printers were introduced around 1970 neither the printers or the computers had enough memory to handle much by way of graphics - but in principle the printer could do it.

Printing poses a very different problem if an A4 page is treated as graphics - the 8x11 inch printable space becomes about 8 million pixels and a megabyte of data. That kind of memory was only available on sophisticated machines at the time and communication links would have difficulty with it as well.

Rather than communicate the individual dots early dot-matrix printers more or less immitated a teleprinter accepting ASCII characters and the udimentary control codes for page layout.

Dot matrix printers holds the dot pattern for the characters to be printed in pre-programmed memory. To form the characters the printer maintains counters that step through character positions, columns and rows. As the printer moves to each new position the counters retrieve the pattern for the character from a Read-Only Memory (ROM).  Green Screen Visual Display Units and basic graphics adapters work in much the same way.
With early screens and dot matrix printers the hardware forming the pixels was capable of graphical work but the available memory and processing support was too limited.

Printer designers first extended the range of characters available. Since computers generally hold data in 8-bit bytes the 7 bit 127 possibility ASCII character set could be doubled by using that extra bit. Some graphical symbols and characters common in European languages were added. The most common character set is that used in the monochrome display adapter (MDA) on the first IBM PCs. 

Rudimentary graphics can be achieved as well. For instace  with the box drawing characters ┌ ┐ └  ┘ the printer or screen can highlight some text or draw a form and with funny little characters like ☂ it can give entertaining messages.

A range of fonts can be handled if they are programmed into the printer’s ROM, chip-makers were developing bigger faster ROMs so this was easy for the printer makers to do. The graphic range can be extended using a special character set or CodePage. The computer sends a selection-code telling the printer which font and / or codepage to use. The selection code usually starts with a special ASCII character "Escape" which tells software looking at the data stream that something different is to be done with the character sequence that follows. Printer instructions are sometimes called "escape sequences". Two of the most famous are ESC/P developed by Epson and PCL developed by HP but there were others. IBM created the PPDS control codes for its Proprinter, Quitwriter and Quickwriter machines in the 1980s although it only got the name with the lauch of the IBM laserPrinter in 1989.  Printer companies like Facit and Newbury Data had their own commands.

Not every system supported the same characters using the same code; competing manufacturers prefered to outdo one another on features. However if one manufacturer developed a feature others would try to emulate it. A whole range of printer and terminal emulations developed. In their later models like the 680 Newbury Data dropped use of their own codes and settled on emulating Epson. 

Vectors

Another way to provide graphics is to provide vector drawing capabilities. The Tektronix 4000 series screens did this using a special cathode ray tube with a memory effect built in - a storage tube. The image was drawn once using vectors fed from the computer or two cursor wheels on the keyboard and then stored using the  phosphor of the screen. The Tektonix screen was expensive and this kind of hardware went obsolete in the 1980s. However the Tektronix 4014 command set was emulated by xterm on Unix and Linux systems so it lives on. Tektorinix also made pen plotters so the vector graphic languages were similar. Hewlett Packard was another maker of pen plotters and their vector communication language HP-GL lives on in some of their printers.

An obvious way to provide graphics on a device that prints pixels is to actually provide a bitmap in memory then take the vectors an do the geometry to map that information into it and from there onto the screen or the page. But as mentioned above the memory equired to do this remained unaffordable. The printer industry had to find workarounds which it did by building on the emulations things like downloadable fonts and creating new enhanced ways to download bitmapped graphics.

Emulations


To sell printers in another manufacturers market the first requirement was to imitate their code, so printer manufacturers commonly "emulate" one-another’s codes.  For some years the computer industry talked of "emulations" – meaning escape sequences and control codes. These emulations are the basis of today's print languages with the exception of PostScript, which we shall come to.

Most emulations include codes that allows the computer to
  • select in built fonts and specify bold, underline and italic presentations.
  • download new fonts
  • download bit-map graphics.
They may also include codes for vector graphics and other drawing elements. In principle it is possible to produce text most efficiently using ASCII codes. line drawings using vector graphics and anything including photograps using bit-mapped graphics.

If a printer is sent codes for an emulation it does not support or that it has not been told to select then it will generally either ignore the code and all that follows (sensibly) or print junk. Even slight differences in the way emulations have been programmed sometimes gives mistakes in the output.
 

Downloaded Fonts

Multiple printer fonts can be selected from a pre-programmed ROM using escape codes, some recent printers have 60 or 80 fonts built in.

A logical next step is to have a RAM and load other fonts as needed. Most printers can also set aside an area of memory and the computer can download fonts into it. The font may need to be downloaded every time the printer is powered up, and if the computer and printer have a slow communications link then the download time may be noticeable.


Downloading fonts gives some increase in flexibility – for instance the new fonts don’t have to be alpha-numeric – they can be made up of graphical symbols.


A further increase in flexibility is available if the printer can be told what scale to reproduce the fonts. Rather than specify the exact pixel pattern for the font specify the vectors making up the characters and then call on the printer to multiply them by some factor to give the required pixel pattern. This extra sophistication requires more memory and processor power, moving towards the printer's main processor being called a "formatter" or "Raster Image Processor" (RIP). 

Formatters and RIPs

This article is following a historical progress, roughly the way the printers developed. In 1984 two new kinds of printer were introduced, the Laserjet and Thinkjet both from Hewlett Packard (HP). Both are aimed at graphics.

To be strictly honest neither was actually new. Laser Printers originated with Xerox around 1970 but they were physically large and the original machine used a PDP11/34 minicomputer as a formatter. Laser printers built this way were expensive so they were far from common. Inkjets were tried by Siemens but Canon introduced their Bubblejet in 1983 and HP the ThinkJet in 1984. HP and Canon formed a relationship on laser printers they always seem to have been rivals in thermal inkjets.


Sometime in the early 1980s Canon began manufacturing the PC-20 personal copier and developed on that basis the LBP-CX engine which was used in the HP LaserJet, and Apple LaserWriter (and QMS and many other machine). The physical structure of the laser printer was very similar for both machines, where they differed was in the formatter board that controls the printer. Apple and HP adopted very different approaches.

Apple adopted the Adobe PostScript interpreter. PostScript is an interpreted language that handles vector and bimap graphics. A font is typically communicated as vectors then scaled, the same would be dome with a drawing. A photograph is sent as a bitmap. The combination of vectors and bitmaps makes PostScript very powerful, able to describe any page and limited only by how much memory is available.  The idea of using PostScript was driven by Steve Jobs and the LaserWriter complemented the new Apple Mac graphical computers. However there was an issue; the 12MHz Motorola 68000 Processor with 1.5 megabytes of RAM and a 512 kilobytes or ROM. The electronics were considerably more powerful and expensive than the Apple Mac itself contributing the printer's price tag of nearly $7,000.

HP used their own PCL3 escape-code language also used by their dot-matrix printers. The simpler language was less demanding. The processor was a markedly cheaper 8MHz Motorola 68000 with just 128 kilobytes of RAM most of which was needed for the page image. The HP LaserJet was far less capable of graphics's than Apple's model - a single photo would exhaust the memory. However the buyers were corporate offices and at that time their PCs ran DOS and neither the software or graphics cards were good at graphics. HPs selling price was half that of the Apple LaserWriter - just under $3,500. The LaserJet provided 4 page per minute high quality typescript. The LaserJet plus provided soft fonts and 512 kilobytes of memory, not quite sufficient for full page graphics.
 
Kyocera took a rather different approach. Kyocera was one of the first companies to produce low-cost high performance laser printers. They also created a language "Prescribe" that could place vector graphics and fonts on the same page. Prescribe used English phrases and mnemonics that resembled the Basic programming language and was reasonably easy to use.  Unfortunately "Prescribe" is now more or less forgotten. It is clever to be able to descrube the vectors to create a form layout in a text files and then send that to the printer - but beyond most users.

Apple's approach created the desktop publishing industry. HP's more evolutionary approach made it more affordable.

Page Description Languages

Today's Page Description Languages  have evolved from humble beginnings.

The sequence of ASCII codes gives a rough description of what a printed page will look like; but it isn't a very good description, either for humans or for the software in a printer. Replace the print-head in a daisy wheel typewriter with one that bears a different font and the page will look different. Switch the default font in a  dot-matrix to 12 characters per inch and the printing will be smaller than expected.

Dot-matrix printers bought the possibility of a graphical page, but they didn't have sufficient memory to print large graphical images quickly and efficiently. Manufacturers devised escape code sequences to switch printers between character pitches and fonts and into graphics modes. Since manufacturers often copied one anothers codes these primitive control languages became known as emulations.  Emulations tell the printer rather more about the page - for instance they specify the font selected and the character per inch. The specification may be quite good, but it only suited the machines of the time. It doesn't usually contain information on margins and most emulations could only handle graphics as a bit-map positioned to a character origin.
 

A dot matrix printer tends to work in successive lines from top left to bottom right of a page. Basic printers always reproduce characters in the same sized cell - typically 7x9 for a nine pin printer; later models might have some measure of proportional spacing. It was usually difficult to position text and graphics on the same line. Graphics were always an after-thought with a dot matrix printer because no matter how good the hardware is in other respects the pins just can't be made small enough to produce a good looking photograph.

Inkjet printers like Canon's Bubblejet and HP's Thinkjet scan a swath across the page. Early models with just a dozen nozzles were similar to dot matrix printers so much of the work of creating a page could be done in the computer, not in the printer.

Lasers and Page Description

Laser printers bring a new freedom to what the printer can do. At root what the laser printer produces is a raster of pixels but they are scanned by mirror and drum mechanisms. Pixels are small and close spaced so vector graphics and photographs look good. A good looking mono photograph is probably being described by 1200 dots per inch at 8 bit depth. The same item in color needs 24 bit colour depth - a significant amount of data.

Laser printers also bring a new need for the page to be described completely before the printer starts. Dot matrix printers can stop at the end of a line.
Laser printer engines need to run continually to the end of a page once the mechanism has started, it would be difficult to stop whilst the processor catches up. Laser printers therefore try to build an image of the whole page in memory.

Apple had produced a graphics based computer in the Mac, so they matched it with a laser printer with full graphics capabilities and a language to match despite the expense. Apple are still regarded as technical leaders today and Adobe Postscript became the standard language for the graphics trades.

Other manufacturers like HP introduced laser printers but compromised on memory and  language to get a more affordable product. If they shipped sufficient memory to describe a whole page in pixels the machines would be too expensive. At the time laser printers were first introduced most of their users had DOS based machines with rudimentary graphics abilities so this wasn't initially a problem. HP's appraoch has been to evlove its PCL language.  Epson has done the same with its Esc/P language


There are several page description languages are in common use today:
 

Many high quality printers use Adobe PostScript. PostScript was originally developed for Apple and has become an industry standard. Licences for "proper" PostScript have to be bought from Adobe, and used to add substantially to the price of a printer. On the other hand PostScript has an excellent reputation for eliability.
 

Hewlett Packard’s LaserJet series used Page Control Language (PCL). Recent versions of PCL have given accurate and eproduceable performance, so there is little practical difference between PostScript and PCL.
 
Providing sufficient memory for a page image has gradually ceased to be much of an issue in the last few years. As mentioned in the introduction to this article the users computer can make up the page image and then dowload that to the printer, either in one shot if it's a laser printer or in swath-sized chunks if it's an inkjet. HP do this with the LIDIL language for instance.  Information on LIDIL

Of course, Hyper Text Markup Language (HTML) is largely a page description language. It has not generally been adopted as a printer control language.

A basic printed page can be produced by a computer just sending ASCII code in the same way that teletypes did long ago. Most printers still have this ability.

--

© Graham Huskinson 2010

This page is like all those in the "book" section in being under development.

If you think this page is wrong in some respect or have better information on how things are done let us know. Click here.