[831] in linux-announce channel archive

home help back first fref pref prev next nref lref last post

Linux Printing Usage HOWTO -- alpha version 1.0

daemon@ATHENA.MIT.EDU (Lars Wirzenius)
Sun Jul 23 05:16:58 1995

Date: Sat, 22 Jul 1995 14:48:39 +0300
From: Lars Wirzenius <wirzeniu@cc.helsinki.fi>
To: linux-activists@niksula.hut.fi, linux-announce@vger.rutgers.edu

X-Mn-Key: announce

From: MATTHEW W FOSTER <mwf@engr.uark.edu>
Newsgroups: comp.os.linux.announce
Subject: Linux Printing Usage HOWTO -- alpha version 1.0
Approved: linux-announce@news.ornl.gov (Lars Wirzenius)
Organization: ?
Followup-to: comp.os.linux.misc

  As some people may know, I am the new maintainer of the Linux Printing
HOWTO.  When this task was bestowed upon me, I decided to do a complete
rewrite of the current HOWTO.  In fact, I decided to do it one better:
I broke it into two HOWTO.  The first part is what you're looking at
here.  It is more like a mini-HOWTO than a HOWTO, but that decision is
up to Greg Hankins, not me.  This HOWTO discusses how to print and
print preview in the Linux environment.

  I am posting it in comp.os.linux.announce in hopes that some people
will read it and HOPEFULLY comment on it.  I am wanting to know what
YOU think.  Do you like the format?  Do you think that the HOWTO covers
enough information?  Am I misinformed in some area?  Is there something
that I left out?  Anything.  I am wanting you to help make it a better
HOWTO.  Any comments can be sent to mwf@engr.uark.edu, or posted on one of
the other newsgroups (since this one is moderated).

  The other part of the HOWTO is still under develpoment.  It will be
called the Linux Printing Setup HOWTO.  It will contain information on
everything that you could ever want to know about installing, configuring,
and maintaining the print system for you Linux environment.  You can 
expect to see an alpha version for it within the next few weeks (no less
than three, sorry).  If you want me to mail you a copy of it directly
when I am finished, please say so in a message to me.

  Again, all comments, criticisms, and suggestions can be sent to me
at mwf@engr.uark.edu.  Also, you can check out the WWW page that I'm
working on for the printing HOWTOs.  The URL is

	<http://www.engr.uark.edu/~mwf/pht/>

Any suggestions will be appreciated.


	--mwf

--
Matt Foster
Linux Printing HOWTO Maintainer
http://www.engr.uark.edu/~mwf/

------------------------------------------------------------------


  The Linux Printing Usage HOWTO
  by Matt Foster <mwf@engr.uark.edu>
  v1.0a, July 1995



  1.  Introduction

  This document describes how to use the line printer spooling system
  provided with the Linux operating system.


  1.1.  Linux Printing HOWTO History

  This version of the Linux Printing HOWTO is a complete rewrite of the
  one originally written by Grant Taylor <grant@god.tufts.edu> and Brian
  McCauley <B.A.McCauley@bham.ac.uk>.  I have tried to keep with the
  coverage of material presented by Grant and Brian's HOWTO, but I have
  drastically modified the style of presentation, and the depth of
  material covered.  I feel that this makes the HOWTO more complete, and
  easier to read.  I can only hope that you agree.


  1.2.  Copyrights and Trademarks

  Some names mentioned in this HOWTO are claimed as copyrights and/or
  trademarks of certain persons and/or companies.  These names appear in
  full or initial caps in this HOWTO.


  The Linux Printing Usage HOWTO v1.0a (c) 1995 Matt Foster.


  Unless otherwise stated, Linux HOWTO documents are copyrighted by
  their respective authors. Linux HOWTO documents may be reproduced and
  distributed in whole or in part, in any medium physical or electronic,
  as long as this copyright notice is retained on all copies. Commercial
  redistribution is allowed and encouraged; however, the author would
  like to be notified of any such distributions.

  All translations, derivative works, or aggregate works incorporating
  any Linux HOWTO documents must be covered under this copyright notice.
  That is, you may not produce a derivative work from a HOWTO and impose
  additional restrictions on its distribution. Exceptions to these rules
  may be granted under certain conditions; please contact the Linux
  HOWTO coordinator at the address given below.

  In short, we wish to promote dissemination of this information through
  as many channels as possible. However, we do wish to retain copyright
  on the HOWTO documents, and would like to be notified of any plans to
  redistribute the HOWTOs.

  If you have questions, please contact Greg Hankins, the Linux HOWTO
  coordinator, at <gregh@sunsite.unc.edu>. You may finger this address
  for phone number and additional contact information.


  1.3.  Downloading the Linux Printing HOWTOs

  It is recommended that if you want to print a copy of this HOWTO, that
  you download the PostScript version.  It is formatted in a fashion
  that is aesthetically appealing, and easier to read.  You can get the
  PostScript version from one of the many Linux distribution sites (such
  as SunSITE <ftp://sunsite.unc.edu/Linux/docs/HOWTO/>), or directly
  from my World-Wide Web site at  <http://www.engr.uark.edu/~mwf/pht/>
  (not fully active yet).
  1.4.  Feedback

  If you have questions, comments, or corrections for this HOWTO, please
  feel free to get in touch with me via email at <mwf@engr.uark.edu> or
  <printing@ennio.uark.edu> (not yet implemented).


  2.  Printing Under Linux

  This section discusses how to print files, examine the print queue,
  remove jobs from the print queue, format files before printing them,
  and configure your printing environment.


  2.1.  History

  The Linux printing system---the lp system---is a port of the source
  code written by the Regents of the University of California for the
  Berkeley Software Distribution version of the UNIX operating system.
  It first appeared on the BSD scene in version 4.2BSD of that software.


  2.2.  Basic Printing

  By far, the easiest way to print in the Linux operating system is to
  send the file to be printed directly to the printing device.  One way
  to do this is to use the cat command.  An example is



       newton$ cat PrincipiaMathematica > /dev/lp




  In this case, /dev/lp is a symbolic link to the actual printing
  device--be it a plotter, typesetter, laser printer, or a lowly dot-
  matrix.  (See ln(1) for more information on symbolic links.)

  A more refined way to print a file is to use lpr.  The lpr command
  takes care of all of the initial work needed to print the file, and
  then it hands control over to another program, lpd, the line printing
  daemon.  The line printing daemon is responsible for telling the
  printer what needs to be printed.

  When you use lpr, the specified file(s) is copied to a directory (the
  spool directory) where it waits its turn in line until lpd gets around
  to printing it.

  Lpr has a very familiar syntax.  It accepts a set of options and a
  list of files to be printed.



       newton$ lpr [ options ] [ filename ... ]




  If a filename is not specified, lpr assumes that the input should come
  from standard input (usually the keyboard, or another program's
  output).  This enables the user to redirect a command's output to the
  printing device.  As such,



  newton$ cat PrincipiaMathematica | lpr




  or, something even more common, like



       newton$ pr -l60 -o2 PrincipiaMathematica | lpr




  The lpr command accepts several command-line arguments that allow you
  to control how it works.  Some of the most widely used arguments are:
  -Pprinter, specifies the printer to use; -h, suppresses printing of
  the burst page; -s, create a symbolic link instead of copying the
  entire file to the spool directory (useful for large files); -#num,
  specifies the number of copies to print; and -m, mail user when the
  printing is completed.

  For example, suppose the user isaac types the following command on his
  system, newton.



       newton$ lpr -msP dj PrincipiaMathematica




  This command would create a symbolic link to the file
  PrincipiaMathematica in the spool directory for the printer named dj,
  where it will eventually be processed by lpd.  Upon completion, lpd
  would mail the user with a notice.


  2.3.  Viewing the Print Queue

  Sometimes it is useful to know what jobs are currently in a particular
  printer's queue.  This is the sole task of the lpq command.

  The syntax for lpq is very similar to that for lpr.



       newton$ lpq -Pdj
       dj is ready and printing
       Rank   Owner      Job  Files                            Total Size
       active isaac      31   PrincipiaMathematica             7682048 bytes




  To see the queue of the system's default printer, you can use the
  following



       newton$ lpq
       no entries




  2.4.  Canceling a Print Job

  Another useful feature of any printing system is the ability to cancel
  a job that you have previously queued.  To do this, use lprm.



       newton$ lprm -Pdj -




  The above command cancels all of the print jobs that are owned by the
  user isaac (if isaac issued the command) in the dj printer's queue.  A
  single print job can be canceled by first getting the job number as
  reported by lpq, and then giving that number to lprm.  For example,



       newton$ lprm -Pdj 31




  would cancel job 31 (PrincipiaMathematica) on the printer dj.


  2.5.  Formatting

  Since most ASCII files are not formatted for printing, it is useful to
  format them before they are actually printed.  This may include
  putting a title and page number on each page, setting the margins,
  double spacing, indenting, or printing a file in multiple columns.  A
  common way to do this is to use a print preprocessor such as pr.



       newton$ pr +4 -2 -l60 -o2 PrincipiaMathematica | lpr -Pdj




  In the above example, pr would take the file PrincipiaMathematica and
  skip the first three pages (+4), print the rest of the file in two
  columns (-2), set the page length to sixty lines (-l60), and indent
  all lines by two spaces (-o2).  Then lpr would print it to the printer
  dj.


  2.6.  The PRINTER Environment Variables

  Instead of having to specify a printer to use every time that you
  print, you can set the PRINTER environment variable to the name of the
  printer that you want to use.  This is accomplished in different ways
  for each shell.  For bash you can do this with PRINTER="printer_name";
  export PRINTER; in csh, you can do it with setenv PRINTER
  "printer_name".  These commands can be placed in your login scripts,
  or issued on the command-line.


  2.7.  Printing PostScript files

  Printing PostScript files on a printer that has a PostScript
  interpreter is simple; just use lpr, and the printer will take care of
  all of the details for you.  For those of us that don't have printers
  with PostScript capabilities, we have to resort to other means.
  Luckily, there are programs available that can make sense of
  PostScript, and translate it into a language that most printers will
  understand.  Probably the most well known of these programs is
  GhostScript.

  GhostScript's responsibility is to convert all of the descriptions in
  a PostScript file to commands that the printer will understand.

  GhostView is an interface to GhostScript for the X Window System.  It
  allows for you to preview a PostScript file before you print it.


  3.  Answers to Frequently Asked Questions


  Q1.  How do I prevent the staircase effect?

  A1.  The staircase effect is caused by the way some printers expect
  lines to be terminated.  Some printers want lines that end with a
  carriage-return/line-feed sequence (DOS-style) instead of the default
  line-feed sequence used for UNIX-type systems.  The easiest way to fix
  this is to see if your printer can switch between the two styles
  somehow---either by flipping a DIP switch, or by sending an escape
  sequence at the start of each print job.  To do the latter, you need
  to create a simple I/O filter (see Q2 and Foster95b).


  Q2.  What is a filter?

  A2.  A filter is a program that reads from standard input (stdin),
  performs some action on this input, and writes to standard output
  (stdout).  Filters are used for a lot of things, including text
  processing.


  4.  Troubleshooting

  This section covers some common things that can go wrong with your
  printing system.



       o  lpd: connect: No such file or device



  5.  References

  This is a section of references on the Linux printing system.  I have
  tried to keep the references section of this HOWTO as focused as
  possible.  If you feel that I have forgotten a significant reference
  work, please do not hesitate to contact me.



          Welsh, Matt. Linux Installation and Getting Started

          Foster, Matt. Linux Printing Setup HOWTO
             the supplement to this HOWTO; covers topics such as
             setting up, and configuring the print software


          Manual Pages

          o  cat(1) -- concatenate and print files

     o  lpd(8) -- line printer spooler daemon

     o  lpq(1) -- spool queue examination program

     o  lpr(1) -- off-line printer

     o  lprm(1) -- remove jobs from the line printer spooling
        queue

     o  pr(1) -- convert text files for printing


     USENET newsgroups

     o  comp.os.linux.* a plethora of information on Linux

     o  comp.sys.bsd.* focuses on BSD, FreeBSD, NetBSD, and
        the like

     o  comp.unix.* discussions relating to the UNIX operating
        system



  6.  Colophon

  This HOWTO was written using vi, the ultimate editor; the human mind,
  the ultimate computer; and a little imagination, the ultimate power
  tool.  The machine of choice was a Gateway2000 i486/50 running the
  Slackware 2.2 distribution with the Linux 1.3.4 kernel.  The original
  document was written in mark-up format using Linuxdoc-SGML (a hacked
  version of Tom Gordon's QWERTZ DTD).  The HOWTO was then emailed to
  many important people, including Greg Hankins, the Linux Documentation
  Project coordinator.  There it was converted to PostScript, LaTeX,
  ASCII, and HTML formats.  Finally it was posted on the USENET, and
  placed in the Linux archives found on the SunSITE FTP/WWW servers for
  easy Internet access.


  7.  TODO



       o  information on printing tex files

       o  graphics printing

       o  fonts

       o  troff/groff

       o  print previewing


       o  dvgt

       o  GhostScript

       o  GhostView








--
Send comp.os.linux.announce submissions to: linux-announce@news.ornl.gov
PLEASE remember a short description of the software.


home help back first fref pref prev next nref lref last post