14 – Printers & Printing

December 5, 2009 – 10:16 pm

Please note… This information no longer exists at the referenced locations.  This is only a copy of what was available in 2003.

Basic Linux Training™

Printers & Printing

Joe Clark

Table of Contents

Printing

The printing process consists of three steps. You issue a command to output a file using a specified printer. A spooler places the file in a queue for that printer. The print server feeds the file from the queue to the printer. If necessary, the file is converted from the internal representation into the language used by the printer. In order for this process to work three pieces of information about the printer must be specified: how to physically reach the printer; what driver and parameters are required to make the printer work; and what filter will be used to translate the file for the printer.

The legacy spooling software is LPD (Line Printer Daemon), which was developed in the days of line printers. LPD has evolved with computing software and hardware but a newer version called LPRng should be used if it is available. The major alternative to LPD is the Common UNIX Printing System or CUPS. CUPS is a new approach based on the Internet Printing Protocol but it does accommodate LPD . CUPS is the emerging standard and several vendors ship with CUPS as the default spooler.

Printers can either be local to your computer or reachable on some other machine through a network. Local printers are generally connected through the parallel port, a serial port or through a USB port. Information about the printer is stored either directly or indirectly in a file called /etc/printcap. The format for information in printcap can be found through man printcap. CUPS only uses /etc/printcap to store a link to the actual printer descriptor file.

Modern printers are sophisticated computer systems. A driver is a program that tells a system like a printer how to process the information it is receiving. Your spooler, LPD, CUPS, etc. requires a driver for each printer that you will use. Your spooler may also require a filter program such as apsfilter or ghostfilter to convert your file from the format produced by your source program into the format required by the driver.

Printers

The linuxprinting.org website has comprehensive information about printers from a Linux perspective. If you have a printer, research it at linuxprinting.org. If you are thinking about buying a printer, do some research on linuxprinting.org to make sure the printer will work with Linux before you bring it home and hook it up.

Setting up your machine can be a major problem with consumer-grade printers. If you’re lucky enough to have one that is fully supported, with PostScript capability, you probably won’t have any problem. On the other hand, if you have one of the least expensive models, don’t expect professional quality pages; and it might be very difficult to set up.

For most purposes, setting up a PostScript printer is not very difficult, and usually a simple matter of choosing your printer make and model in the utility printool, apsfilter or magicfilter. Keep in mind that the lpd daemon uses the /etc/printcaps file for the printer information, and that ldp actually handles the print job – you need to kill the daemon to change anything in the printing process; see the man pages for lpc and lprm.

CUPS setup is handled through a web interface located on your computer at http://localhost:631/admin. Documentation can be found at http://localhost:631/documentation.html, if you have CUPS installed and if the CUPS daemon is running. Otherwise, documentation should be found at /usr/share/doc/cups/.

One of the most common problem seems to be ‘stair-case’ printing, so you may have to check your ‘Owner’s Manual’ to see how to set your DIP switches for Unix (carriage return and line feed are different between Unix and DOS, which causes this effect). However, if you’re dual-booting with DOS/Windows, you can use samba to print through your existing setup – which often is a better solution, at least for the time being.

Of course, the more sophisticated and professional your needs, the more time and effort you need to put into it, and the more money you should be willing to invest in a high-quality printer. Since printing is so important in so many situations, the documentation has already covered what you want to do. Don’t forget to check the homepage for the manufacturer, as well.

Command Line Interface Text Tools

There are a very large number of text processors for the Command Line Interface (CLI).  The old standards are VI and Emacs.  Pico is a small text processor that is relatively easy to use.  Joe is a multiple personality text processor.  JPICO emaulates Pico.  JMACS emulates GNU-EMACS.  JSTAR is very similar to Wordstar.

After you finish editing your file, you can print it with a command like:

lpr -P/dev/lp0 myfile

-P/dev/lp0 selects a specific printer.  If /dev/lp0 is your default printer you would only need:
lpr myfile

GUI Tools

In the GUI world text editors, html editors, word processors and graphics programs exist side by side and can be accessed with the standard rodent activities.  The KDE and Gnome menus will include a set of text editors that include the CLI editors plus some  GUI based editors including gedit, kedit and XVIM, a very enhanced version of VI.  Word processors come under a separate menu item.  AbiWord is one of the standard word processors available.  It can work with some MS Word documents.  KDE offers its own set of text and word processing tools.  Integrated office suites include Koffice, Open Office.org, and Star Office.  The GUI based editors and word processors will come with a toolbar that includes a print icon to hide the complexities of the print process discussed above.

Professional Tools

Moving up to the sophisticated professional typesetting and commercial printing and publishing, understanding text processing may be a little complicated to grasp at first. For most users, this is overkill, but it’s useful to know something about it. Despite all the hype in the media over the past 20-30 years about a ‘paperless’ office, the world still runs on printed, faxed, and photocopied documents ;-)

Since the early days, Unix was considered as the perfect front-end to robust printing systems. You can see some good examples of this in groff – which is the GNU version of the troff. These processors take output from text editors and format them for a wide range of devices including PostScript printers (long a favorite in Unix and Linux) to include columns, fonts, boxes, and other typographic and layout elements. The man pages are formatted this way, but perhaps a better example would be something a little more tangible – like the pages in your textbook. Many publishers use TeX because it is a fixed standard that won’t change at the the whim of the software manufacturer. Documents written today can be printed 5, 10, 50, or 100 years from now without any incompatibilities introduced or proprietary ‘extensions’ to monopolize the market ;-)

TeX works like groff – only on steroids. If you want to typeset pages for science, mathematics, or foreign languages, TeX (or LaTeX, th GNU version in Linux) is what you should use. It’s widely used in the printing and publishing industry, as is SGML.

Almost everything in the Linux Documentation Project is in SGML format which can be quickly translated into HTML, Postscript, plain text, etc., from the same source document. Some publishers (notably O’Reilly) are asking that all manuscripts be formatted in SGML, and more recently the move has been toward XML. Using one document for everything saves time and work, reducing errors and making revision quick and easy.

A newer text-formatting program, texinfo, is aimed at setting up information files that can be accessed from the help systems within applications or from the command line, and that can also be printed into a traditional manual. The key idea here was to have once source file that can be reformatted for these other purposes, rather than a separate file in each format that have to be maintained individually.

More likely than not, you’re never going to need anything that sophisticated, so just be aware that it’s available.

Assignments

Terms and Concepts:

Define and add these to your glossary:

  • text formatter
  • text processing
  • word processing
  • spell checker
  • register
  • macros
  • regular expression – regexp
  • grep
  • TeX
  • LaTeX
  • groff
  • troff
  • Texinfo
  • SGML
  • XML
  • HTML
  • ldp
  • nemscript
  • cups
  • PPD
  • dvi

Online:


Copyright © 1997-2003 Henry White. Copyright © 2003 Joe Clark. All Rights Reserved.
Reproduction or redistribution without prior written consent is strictly prohibited. Address comments and inquiries to info@basiclinux.net

Sorry, comments for this entry are closed at this time.