Notes for Week 7

Our distribution uses CUPS for printing, and the following is based on that. Another alternative for printing is lprng.

  1. Printers are added or modified online (push "Continue" buttons as necessary):

    1. "Add Printer" (you will be required to provide the root password)
    2. "LPD/LPR Host or Printer"
    3. Connection: lpd://
    4. Name: laserjet
    5. Make: "HP"
    6. Model: "HP Laserjet 4300 - CUPS+Gutenprint v5.2.9 (en)"
    7. "Add Printer"
    8. "Set Default Options"
    9. click on Administration tab again and "Manage Printers"
    10. "laserjet"
    11. "Administration / Set As Server Default"

    You can also restrict usage of a printer to specific users using that tab.

    Printer definitions are kept in /etc/cups/printers.conf.
  2. Print spooling is handled by cupsd, the CUPS scheduling daemon. The sequence of events in printing is typically:

    1. A user sends print output (usually either postscript or plain text) to the print queue (or spool queue) using the lpr command (the PRINT command in Windows). The output, as well as a small control file, are placed in the spool directory (/var/spool/cups). Each print request is called a job, and is numbered.
    2. The scheduler starts a process to filter the print file as necessary. For instance, a postscript file to a postscript printer needs no filtering, while a postscript file to a non-postscript printer must be filtered. Each printer has an associated Postscript Printer Description (PPD) file, which determines what, if any, filtering is necessary.

      The output of the filter is then passed to the appropriate backend:

      • local (parallel or USB) printer driver
      • TCP print protocol stack for a remote LPD printer
      • SMB protocol stack for a Windows print share
    3. The spooled data file is eventually removed from the spool directory.
    Note that files in the spool directory are only accessible by root.
    Logging is done in /var/log/cups/error_log and /var/log/cups/page_log.
  3. Printers and print queues are manipulated using the following commands:

    Note that once a print job is sent to a networked printer, it is often difficult to control it from the host. This is especially irritating when the printer malfunctions.

  4. Both postscript and PDF (portable document format) files are text files whose contents contain a description of the print output using a device-independent programming language. PDF files may be viewed using xpdf.

    Note that emacs can print a file using postscript instead of plain text, and that the results are far superior to plain text printing (use the "Postscript Print Buffer (B+W)" command).

  5. You should always use non-proprietary, industry standard formats for files to be shared with others.
    Don't fall into that lazy trap of assuming that everyone in the world has a Windows system just like yours. If you send everything in Word or Windows Media formats, you will be shutting a lot of people out from seeing your content.

    And the world is full of poorly written web pages that only display well in one specific screen resolution.

    This means:

    Geeqie is an image browser which is useful for viewing image files. For image manipulation you definitely have to try gimp (the Gnu Image Manipulation Program; free and almost as powerful as Photoshop).

    mplayer can be used to play virtually any format of sound or video, provided that it has been built for the specific format you're interested in. mplayer --help will display the basic key bindings available to control playback.

    Several steps may be necessary if you wish to use mplayer in the lab to play any of the audio files mentioned here:

    1. modprobe snd-intel8x0
    2. Run alsamixer, un-muting the master volume and setting the volume.
    3. Optionally add any users who need audio access to the audio group.
  6. In order to compare file formats, a 26 second video was recorded and the following files prepared:

    A still image of the poet was captured from the video and stored in a variety of formats:

    The poems themselves can be stored in a variety of ways:

    Note that all of the compressed formats use lossy compression (some data is lost). Also note that by far the most efficient storage method is plain text.

  7. EXERCISES for Week 7:

    1. Use lpr <filename> to print a short text file. Examine the spool queue, and the spool files created for the job. Send the control file in your weekly e-mail to the instructor.
    2. Disable spooling to the printer. Attempt to print. What happens? Re-enable spooling to the printer, but disable printing from the queue. Attempt to print. Examine the spool queue. Finally, re-enable printing from the queue and examine the log files. Include all log messages regarding the printing attempts in this exercise in your weekly e-mail to the instructor.

©2015, Kenneth R. Koehler. All Rights Reserved. This document may be freely reproduced provided that this copyright notice is included.

Please send comments or suggestions to the author.