May 2000 Column


[ Site Index] [ Linux Index] [ Feedback ]


Printing on Linux

Recently, an acquaintance asked me about how easy it is to print from Linux. Is it, for example, possible to buy an off-the-shelf printer and get it to work? How about drivers? What are the pros and cons of printing on Linux?

Linux is descended from UNIX. Not many people know this, but UNIX was originally written as a word-processing system for use in-house at Bell Labs, back in the precambrian era of electronic document processing, when there was no standardization and most output devices were either hulking mainframe line printers or eye-wateringly expensive phototypesetters.

(According to legend, Ken Thompson, Dennis Ritchie, et al, had spent so long writing their OS that when they realised they'd nearly run out of time and money on their project plan they just about panicked; the project said "write a document processing system", not "invent a new, world-beating operating system". So a talented AT&T programmer, Joe Ossanna, sat down and invented the troff typesetting system in one month flat, in 1973, using PDP-11 assembly language and hard-wiring it to drive the Graphic Systems CAT typesetter. They shipped a bunch of PDP-11's running the new UNIX system to offices around AT&T, where it served as an industrial-strength text processing system. It was re-written in C in 1975, and in 1977 Ossanna was talking about re-writing it so that its macros were more human-friendly. Then, in a tragic accident that cast a horrible blight over the working life of thousands of authors and typesetters, Ossanna was run over and killed by a car. In 1979 Brian Kernighan re-wrote it so that it could produce output for a variety of typesetters, but kept the hideous macro language the same. If you've ever wondered where early word processors like Wordstar got their dot commands from ...)

In addition to having one tool to produce typesetter-friendly output, the original UNIX system had a printer management system called lp (line printer), designed to handle multiple job queues, spooling, reporting of printer status, cover sheets on documents, and so on and so forth -- all stuff you'd expect, given that its role was seen as a departmental printing system with many users at teletype terminals sending documents to many printers (from the old, lumbering line printers to the horrifically expensive phototypesetters).

The print spooler side of UNIX got it pretty much right. It hasn't evolved much over the past twenty years, other than to add the ability to talk to other print spoolers and printers using TCP/IP, and to run "magic" filters on files in the job queues, to convert them into some format appropriate for output on the printer they're being despatched to. The reason it hasn't evolved much is that the initial requirement represents massive overkill for most modern machines: we don't normally expect one computer to drive hundreds of printers. (Maybe this is why Cisco's corporate print network is run by a group of Linux boxes.)

The magic filter is deceptive: actually it's critically important. Most people "pay no attention to the man behind the curtain": in the case of printing on Linux the little man who makes things work is a piece of software called Ghostscript, and the magic filter is the curtain he hides behind.

Ghostscript is a postscript interpreter maintained by Aladdin systems. It's semi-commercial insofar as you can pay them for a commercial license to incorporate it in commercial software, or you can use the (free but not commercially redistributable) Aladdin Ghostscript, or you can use last years' version (and older versions) as GNU Ghostscript. Incidentally, Ghostscript is written in C and is highly portable; it runs on a wide range of UNIX systems, VMS, MS-DOS, QDOS, AmigaOS, and MacOS.

Ghostscript interprets postscript programs and produces output in file formats suitable for various printers (and display via X11). In general, when printing on Linux you simply make sure that your program outputs raw text or postscript. The magic filter in the print queue autodetects the nature of the file, and if it's postscript, feeds it to Ghostscript, which renders the page and dumps an appropriate bitmap for your printer. (Unless you've got a Postscript printer, in which case you don't need Ghostscript at all.)

(You can find Ghostscript here.)

Ghostscript drivers are available for a variety of printers; in particular HP printers are well-covered. You can also take Epson dot-matrix printers as a given, along with some Canon bubblejets and Apple Imagewriters. (See the printer compatability list for full details.) However, the range of supported printers is pretty poor compared to the slew of printer drivers that you get with Windows. Corel appear to be particularly aware of this problem; according to opensource.corel.com, they are working on an enhanced open source printer subsystem for Linux:

"The library provides APIs for accessing available printers, information on a printer's capabilities, control of printer-specific features, the mechanism for sending jobs, accessing queues, installing printers, and access to information on available printer models. We aren't attempting to provide a new graphics API, nor have we created a new driver architecture."

One of the goals is to provide support for PPD or UPDF (universal printer description files) to lpr and Ghostscript, or some equivalent system. It's still a work in progress, but with Corel targeting it as an important requirement for porting their application base to Linux (and out of territory dominated by their arch-enemy, Microsoft) progress appears to be likely.

There are problems, of course: some printers in particular will probably never work with Linux -- ever. These are the Winprinters. Most printers actually have a microprocessor of their own; they interpret an incoming data stream and convert it into a bitmap, then drive hardware that puts ink on a sheet of paper in the appropriate positions. Sometimes this built-in intelligence is quite smart. For example, HP PCL (printer control language) printers use an extended version of the TIFF bitmap format, along with some additional metainformation, as its bitmap format for printing. Postscript printers actually interpret programs in Postscript, a stack-based language used for describing images: "move to coordinates X1,Y1, then draw an arc of radius Z points and origin X2,Y2 to coordinate X3,Y3".

Winprinters (and Apple Quickdraw printers like the StyleWriter family) offload the processing workload onto the CPU of the host computer; they basically expect the computer to send them a finished bitmap in a suitable format for squirting onto the page, intermingled with signals to do things like move the inkjet print head or switch on the motor that moves the paper, rather than having any kind of internal page description language. Supporting them would entail working out how their hardware communicates with the host PC (usually using some proprietary parallel-port or USB protocol), then writing an emulator for the Windows driver -- or taking the Windows driver and re-compiling it for a different platform. This is a lot harder to do than dumping a print file in a well-known, published format to a parallel port device that's smart enough to do the rest of the job.

(On the other hand, they said that WinModems would never work with Linux, and now the protocols for some of them have been reverse- engineered, and in other cases the manufacturers have begun writing drivers for Linux. There's hope, yet.)

If I had to recommend a printer for general use with Linux, I'd point at Hewlett-Packard. I've used HP kit for years; personal experience says that it's rock-solid. I'd be conservative and go for a parallel-port printer (USB support on Linux is still immature). If I wanted colour, I'd look at an 800-series Deskjet -- Ghostscript 5.0 and higher will deliver colour output at 600x600 dpi on such printers. For black-and-white, it depends on budget and throughput; for home and light office use I find a Laserjet 1100 quite satisfactory, but if I was concerned with output quality I would probably consider a big, fast, expensive Postscript printer instead. The one gotcha to note is that hybrid fax/printer/scanner machines aren't really supported on Linux yet, as HP's protocol for controlling such devices hasn't been fully reverse- engineered; you might be able to use one as a printer, but you might get your fingers burned. A project is underway to provide drivers for these machines, but only a few are operational. In the meantime it's a lot more sensible to buy a SANE-compatible scanner (there's a list of scanners for which SANE has drivers on the website) and a separate printer.

The lizard is coming

It's commonly asserted -- by people who should know better -- that the browser wars are over: that Microsoft's standard predominates, Netscape has been bought and stripped by AOL, that there is no competition in the web business. I've got news: by the time you read this column, the browser wars will be headline news again.

First, there's a cloud on Microsoft's horizon called Opera. Even though Windows includes a free integrated copy of Internet Explorer, it seems that many users are happy to pay for a shareware alternative. Opera is small, fast, fits on a floppy disk, and comes from Norway. It's generating up to 10% of page hits logged by Browserwatch, a sure sign that people who use the web a lot are enthusiastic about it. (Page hits are a lousy way of identifying what web browsers people are using -- for example, 99% of all AOL pages are served via their internal proxies, so AOL's browser is grossly underrepresented. Nevertheless, this illustrates a trend.) Opera is now being ported to Linux; a beta version is circulating, and the final Qt-based browser should show up before the middle of this year.

It's also worth noting at this point that KDE 2.0 incorporates a new browser, Konqueror. Konqueror is a masterpiece; when finished it should be able to cope with javascript and java applets as well as any big-name browser, in addition to seamlessly integrating with the KDE desktop and supporting plugins to allow viewing of unusual file types (such as PDF or Postscript documents).

More importantly, Mozilla is now in beta. A year behind schedule it may be, but Mozilla is going to re-ignite the browser wars like nothing before.

Mozilla is effectively Netscape: the next generation. (AOL will be rolling it out as Netscape Navigator 6.0 when it's ready for prime time, skipping a version number for no obvious reason.) Two years ago, when they appeared to be losing the browser wars, Netscape handed over the source code base to their product to the Mozilla project, an open source development group (mostly staffed by Netscape engineers). After a few months the Mozilla developers realised that fundamentally, Netscape was a huge kluge; it needed to be re-written from scratch. Hence the long delay in seeing a product -- this is a complete re-write of their browser, starting from first principles. For a long time the torch was carried by a few Netscape/AOL engineers: but now Mozilla is stable enough for ordinary users, it's attracting contributions from the open source community in increasing numbers.

At Mozilla's heart there is a new rendering engine -- the chunk of code that takes HTML and turns it into a bitmap in a window. Actually, this rendering engine (called Gecko) isn't a pure HTML renderer; it's fully XML compliant, and can cope with CSS1 and CSS2 stylesheets. It's also object-oriented. All the other components of Mozilla hang off the rendering core, adding functionality -- Java runtime, mail and news APIs, and so on. What's really revolutionary is the way the graphical user interface works. Instead of a hard-wired GUI programmed using a toolkit like Motif, with fixed menus and dialogues, Mozilla uses its XML parser to effectively compile a description of a user interface (formed in XML) into calls to an interface library. On Linux and UNIX, it uses the same Gtk library used by the GIMP and Gnome. It's totally themable, and totally open: you can download new look and feel skins for Mozilla, or write your own.

You can add menus that inteface Mozilla to other applications; for example, a sub-project is underway to link Mozilla to the Zope web application server, effectively turning Mozilla into an integrated development environment for Zope. As Mozilla already includes a kick-ass HTML editor -- and I say this advisedly, speaking as someone who codes his HTML by hand and considers most HTML editors to be abominations -- this makes sense. It also makes Mozilla part of an insanely great content publishing system that has the potential to rival anything available on any other platform. Think in terms of using Mozilla with Zope extensions as an IDE for developing a dynamic website, served via Apache and Zope. Think in terms of inserting an image on a web page -- only to have the GIMP come up as your image editor, one step removed from PhotoShop. This is a compelling end-user application for Linux, one that may be the first toe in the door of the hitherto Mac-only design business.

First impressions of Mozilla are that it is fast. In no small part this is because the Gecko engine really is fast: but it has a number of sophisticated speed-ups, such as the ability to incrementally render tables in complex HTML documents, so that they show up as the file loads (rather than waiting for the whole download to complete). The highly customizable panels are a new feature: it's far more than the old Netscape "what's related" feature. You can, in effect, define your own web portal by subscribing to RSS streams from sites like Slashdot or Alan Cox's Linux Portaloo. Another big plus is that Mozilla is entirely standards-based. While Microsoft and Netscape of old battled it out by trying to subvert the World Wide Web Organisation's standards process, Mozilla is open source, pure, and fully compliant. This actually rids us of the old headache of testing web pages against different browsers to see how they look; Mozilla should be a good test-bed for documents.

My latest Mozilla download is Milestone 13. Milestone 14, due next week (four to eight weeks ago to you) should be the official beta release. I'm already using M13 some of the time; by M14 I'm confident of being able to switch entirely from the tired, elderly, memory-hogging Netscape to its new incarnation.

Merger mania

Two big mergers happened this month: one in the Linux field, and one outside it but with big implications for the inside.

The first one saw Linux workstation vendor VA Linux Systems snap up Andover.Net. Andover.net, in case you didn't know, is a web portal company; they recently bought the huge portal site Slashdot (http://slashdot.org/), probably the premier starting point on the web for all things Linux-related and newsworthy. They also own Freshmeat, one of the best index sites for Linux software. This doesn't seem to match VA's corporate profile -- VA Linux Systems build and sell PC's with Linux preinstalled on them -- until you realise that VA own the prestigious and underused linux.com domain.

VA is growing rapidly, but it can't be long before the big PC manufacturers wake up and start targeting the upstart. Dell and IBM are both shipping laptops with Linux preinstalled; IBM seems almost to have decided that Linux is a suitable successor to OS/2 as keystone to its non-Microsoft-friendly PC strategy. VA is going to have to fight hard to maintain growth and market share in this environment. However, if VA can use their other corporate assets -- www.linux.com and the portal sites like slashdot that they just acquired by way of the Andover takeover -- they may well prosper. The combination of web portal operator and hardware vendor is an unusual one, but we shouldn't write it off: it makes as much (or as little) sense as the combination of software vendor and PC manufacturer, and Apple and IBM both made substantial livings in that niche for a considerable period of time. Even if VA Linux Systems are stalled in the server market, they now have a corporate lifeboat. The only pause for concern is that VA are not a media company: they'll have to learn -- and learn fast -- just how important editorial independence is in this new field.

The second takeover of the month was far more earth-shaking. Corel (who a year ago got Linux religion, and who now say they're aiming to move 50% of their corporate revenues to Linux within two years), bought Inprise -- the corporation formerly known as Borland.

Borland, lest we forget, was a major player in PC software not so longer ago. Good things came from Borland, starting with SideKick and Turbo Pascal in the mid-eighties: it would be no overstatement to describe these as revolutionary applications that spawned a horde of imitators. Along the way they made an abortive move into office software, with the (successful) Paradox database, (unsuccessful) Sprint word processor, Quattro spreadsheet, and other items. Ultimately it all came unglued when they acquired database vendor Ashton-Tate, but failed to revive sales of the dBase product line on the then-new Windows platform. They still have a devoted following for their core product range, development tools such as Delphi (an object-oriented Pascal descendent -- Pascal on anabolic steroids, with a graphical interface generator and heavyweight database extensions) and Interbuilder. And of late they've been looking to Linux, making interesting moves such as releasing their Interbase database server (which had become uneconomical for them to maintain) as open source.

(The Interbase move is a fascinating one. Interbase has a small but devoted following. By stopping development but releasing it as open source, Inprise made a very smart move -- they refrained from chopping their users off at the knees, while keeping open the option of resuming development and sales of Interbase support services at some future date.)

Now, the merger.

The press release that Corel and Inprise issued ran to about ten pages and mentioned Linux no less than fifty-five times. (grep and wc are my friends -- I wasn't sad enough to count this by hand!) It looks as if the point of the merger was complementarity. Inprise's application sales are pretty much dead at this point -- nobody is buying dBase any more. The only really useful markets are for Paradox and Quattro Pro, the latter being licensed to Corel as a component of Corel Office. (Note: Corel Office 2000 for Linux should be in beta test by the time you read this.) However, Inprise's development tools business is still going strong. Meanwhile, Corel has a Linux distribution and a successful office package offering, but not so much by way of development tools -- except for their deep support of the WINE libraries, essential for porting from Windows to Linux easily.

My money is on rapid releases of Borland's development tools on Linux, including Delphi for Linux (already under development), and integration of key components (such as the interface builder) using WINElib. There may be surprises -- I for one would love to see a Turbo Perl development environment on Linux -- and then again, there may not be. Whatever the outcome, though, the combined company is going to be a major player. They have a very slick metadistribution based on Debian Linux. They have an office suite as powerful as StarOffice, with better graphics tools (Corel Draw 9, for example, and Corel PhotoPaint). Now they have a development tools arm that puts out one of the nicest RAD environments for Windows, and they're talking Linux. They have two thousand programmers, an order of magnitude more than any other Linux company. And they really get the open source idea, in a way that Sun and Apple and the traditional players (even Microsoft) simply don't. Both companies have released products under open source licenses and are playing by the rules. It's going to be interesting to watch what they come up with ...


[ Site Index] [ Linux Index] [ Feedback ]