; Printing
Learning Center
Plans & pricing Sign in
Sign Out



  • pg 1

 Some printer jargon
   Spooler
    • A piece of software
   Dpi
    • Dots per inch
   PDL
    • Page description languages
   Bitmap
    • Common bitmap formats include JPEG, PNG,
      TIFF and GIF

                                        Introduction   1-1
 Some printer jargon (cont)
   RIP
       • Raster Image Processor
       • Converts PDL documents to a bitmap
     Filters
       • Programs that modify jobs en route from the spooler
         to the printer
     Postscript
       • The most common PDL found on Unix
     PCL
       • Exclusively on Hp printers and quite common in PC

                                                     Introduction   1-2
Types of printers
 By connection interface
    Serial port
    parallel port
    Universal Serial Bus (USB)
    Network
      • Full-fledged network interfaces
      • Computer can spool directly to the network printer
          – Many network laser printers include a lpd server that runs
            inside the printer.
      • To simplify administration
          – Set up a few host to control the printers
          – Other machine simply transmit jobs to these print server
                                                            Introduction   1-3
BSD Printing
 Redhat and FreeBSD use BSD printing system.
 Daemon lpd
    Accepts print jobs from users or other (remote) lpds
    Processes the jobs
    Sends jobs to an actual printer
    reads /etc/printcap and is started at boot time

 Program lpr allow users to submit print jobs to lpd.
    Lpr and lpd communicate through the unix socket
    Which printer to use
       • Option -Pprinter
       • Env $PRINTER
       • Default printer lp, or the first one in /etc/printcap

                                                             Introduction   1-4
BSD Printing
    Spool
      • Lpr create two files under the printer’s spool dir
            control file started with cf
            data file started with df
  Lpr notifies lpd of the job’s existence
  Lpd then check printcap to determine if the
   destination is local or remote
      • If remote, lpd opens a connection to the remote
        machines’ lpd, transfer the cf and df file,and delete
        the local copy
      • If local, lpd creates a series of UNIX pipes between
        the spool file and hardware to transport the data –
        filter processes

                                                      Introduction   1-5
BSD printing commands
Command     Location    Function

lpq         /usr/bin    Shows print queue contents and status

lpr         /usr/bin    Queues jobs for printing

lprm        /usr/bin    Cancels a queued or printing job

lpc         /usr/sbin   Controls a printer or queue

lpd         /usr/sbin   Schedules and prints jobs

printtool   /usr/bin    Configures the printing system

                                                      Introduction   1-6
BSD Printing
 lpc : make administrative changes
   Enable or disable queuing for a particular printer
        • enable/disable printer
      Enable or disable printing on a particular printer
        • start/stop printer
      Remove all jobs from a printer’s queue
        • clean printer
      Move a job to the top of a printer’s queue
        • topq printer jobid
        • topq printer username
      Start, stop or restart the lpd daemon
        • restart printer
      Get printer status information
        • status printer

                                                            Introduction   1-7
BSD Printing
 /etc/printcap file
   BSD printing system’s master database
   A printer must be described in the printcap file
    before jobs can be submitted it.
   Printcap format
      • Name:xx=string:xx#number:xx=string… …

                                                Introduction   1-8
        Printcap variables
Name        Type     Meaning               Example
sd          string   Spool directory       sd=/var/spool/lpd/howler-lw
lf          string   Error log file        lf=/var/log/lpr
lp          string   Device name           lp=/dev/lp0
af          string   Accounting file       af=/usr/adm/lpr.acct
rm          string   Remote machine name   rm=beast.xor.com
rp          string   Remote printer name   rp=howler-lw
of          string   Output filter         of=/usr/libexec/lpr/lpf
if          string   Input filter          if=/usr/sbin/stylascii
mx          number   Maximum file size     mx#0

                                                          Introduction   1-9
System V printing
 Used by HP-UX, SCO Unic, Solaris etc.
 System V spooling subsystem’s major components:
    Spooling daemon: lpsched responsible for carrying out
     print requests by sending data to the appropriate
    User commands
        • Initiate print requests: lp
        • Cancel a pending request: cancel
        • List queue contents: lpstat
      Administrative commands
        • Accept, reject, enable, disable, lpadmin, lpmove, lpusers

                                                             Introduction   1-10
System V printing
      Spooling directories under /var/spool/lp/request named
       for each printer
        • By default the actual file to print is not copied. The
          changing or deleting a file before it is printed affects the
          final output.
        • Use –c option to lp to copy the file to the spool area
 Device classes
    Group similar devices and declare them to be equivalent
     to and substitutable for one another.
 Setting the system default destination
    Use the –d option to the lpadmin command
        • #lpadmin –dprinter2
        • #lpstat –d
      User may set the env LPDEST

                                                              Introduction   1-11
System V printing
 Obtaining Destination Status Information
     Lpstat command
       •   Accept job or not: -alist
       •   Display the members: -clist
       •   List print requests: -olist
       •   Display the current status: -plist
       •   Display users’ jobs: -ulist
       •   Display the special files: -vlist
       •   Display summary: -s
       •   Display all status info: -t

                                                Introduction   1-12
System V printing
 Controlling print queues
    Use accept and reject commands to permit and
     inhibit spooling to a print queue.
    Example:
        # reject –r “ There is no paper in the entire building …” laserprinter
        #accept laserprinter

 Controlling the status of a particular printing
      Use enable and disable commands followed by a device
      Example:
        #disable –r “ changing toner cartridge; back by 11” laserpritner
        #enable laserprinter

                                                                    Introduction   1-13
System V printing
 Starting and stopping the print service
   Started automatically at system boottime
        • Such as /etc/rc2.d/S80lp
      Check if the scheduler is running
        • #lpstat –r
      Stop and start printing service manually
        • #lpshut
        • #/etc/rc2.d/S80lp start
 Managing printers and destination classes
   Use lpadmin command to define and modify
    characteristics of printer devices and classes
        • Stop lpsched first

                                                  Introduction   1-14
System V printing
   • Adding a printer
      #lpadmin –p printer –v special-files interface-option
      Where interface_option can be
           » -e printer
           » -m model
           » -i interface-path
        #lpadmin –pPS4 –v /dev/tty02 –ePS3
   • Modifying and deleting printers
      – Option –x removes a printer
      – Option –P changes a printer if it is existed.
   • Managing Device class
      – Use –c option to place a printer into a class
           » #lpadmin –pPS2 -claser

                                                              Introduction   1-15
System V printing
 Adding a New printer
   Physically connect the printer
   Change the ownership of the special file to the
    user lp and change its mode to 600
   Check startup file (s file and K file)
        • Make links if they do not exist
    Shutdown printing service with lpshut if
     running, and then use lpadmin to add the printer
    Start the printer and its queue
        • #accept PS3
        • #enable PS3
      Test the new printer by spooling a small file.
                                                 Introduction   1-16
Network Printing
 Sharing printers among systems within a local area
      Print server: allow users on other hosts send jobs to one
       or more of its printers
      Clients: send the jobs to remote hosts.
 Between BSD System
    Outgoing
        • Set up printcap entry to specify
            – the destination host (rm)
            – The target printer (rp)
      Incoming
        • Allow a remote system to print
            – /etc/hosts.lpd or /etc/hosts.equiv

                                                        Introduction   1-17
Network printing
 Remote printing under Solaris
     Outgoing
       • Register the remote system name using lpsystem
       • Set up a queue using lpadmin
     Incoming
       • Handled by the Service Access Facility
          – Configure the local listen port monitor using pmadm

                                                           Introduction   1-18
 Let’s configure the printer on Solaris
   Connect the printer to the network
   Set the printer IP address/netmask
   Define the printer on your Solaris box
      • Use lpadmin sun as
         #lpadmin –p printername –s systemname
      • Or use /usr/sadm/admin/bin/printmgr
   Enable the printer
   Print a test page

                                                 Introduction   1-19
 Configure the printer on Linux with CUPS
     CUPS: common Unix printing system
       • Dynamic printer detection
           – Broadcasts the printer available
       • Grouping printers
       • Integrating with Windows
   Configure it via localhost:631
   Disable the queue
   Disable the printer
   Cancel a job
   Check the print queue

                                                Introduction   1-20

To top